diff options
author | Dees_Troy <dees_troy@teamw.in> | 2012-11-14 23:27:31 +0100 |
---|---|---|
committer | Dees_Troy <dees_troy@teamw.in> | 2012-11-15 20:27:08 +0100 |
commit | 16b74353d99615b4acbb60f3fbe49f4443e0365f (patch) | |
tree | f4e4f76c1522d809646d213b6f54ab948b3a9a1e /partition.cpp | |
parent | add exfat to partitions.cpp (diff) | |
download | android_bootable_recovery-16b74353d99615b4acbb60f3fbe49f4443e0365f.tar android_bootable_recovery-16b74353d99615b4acbb60f3fbe49f4443e0365f.tar.gz android_bootable_recovery-16b74353d99615b4acbb60f3fbe49f4443e0365f.tar.bz2 android_bootable_recovery-16b74353d99615b4acbb60f3fbe49f4443e0365f.tar.lz android_bootable_recovery-16b74353d99615b4acbb60f3fbe49f4443e0365f.tar.xz android_bootable_recovery-16b74353d99615b4acbb60f3fbe49f4443e0365f.tar.zst android_bootable_recovery-16b74353d99615b4acbb60f3fbe49f4443e0365f.zip |
Diffstat (limited to 'partition.cpp')
-rw-r--r-- | partition.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/partition.cpp b/partition.cpp index c9b10dab5..8aa7f0ae9 100644 --- a/partition.cpp +++ b/partition.cpp @@ -183,15 +183,20 @@ bool TWPartition::Process_Fstab_Line(string Line, bool Display_Error) { Has_Data_Media = true; Is_Storage = true; Storage_Path = "/data/media"; + Symlink_Path = Storage_Path; if (strcmp(EXPAND(TW_EXTERNAL_STORAGE_PATH), "/sdcard") == 0) { Make_Dir("/emmc", Display_Error); - Symlink_Path = "/data/media"; Symlink_Mount_Point = "/emmc"; } else { Make_Dir("/sdcard", Display_Error); - Symlink_Path = "/data/media"; Symlink_Mount_Point = "/sdcard"; } + if (Mount(false) && TWFunc::Path_Exists("/data/media/0")) { + Storage_Path = "/data/media/0"; + Symlink_Path = Storage_Path; + DataManager::SetValue(TW_INTERNAL_PATH, "/data/media/0"); + UnMount(true); + } #endif #ifdef TW_INCLUDE_CRYPTO Can_Be_Encrypted = true; @@ -1054,24 +1059,27 @@ bool TWPartition::Wipe_Data_Without_Wiping_Media() { return false; ui_print("Wiping data without wiping /data/media ...\n"); - system("rm -f /data/*"); - system("rm -f /data/.*"); DIR* d; d = opendir("/data"); - if (d != NULL) - { + if (d != NULL) { struct dirent* de; while ((de = readdir(d)) != NULL) { - if (strcmp(de->d_name, "media") == 0) continue; + if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0) continue; + // The media folder is the "internal sdcard" + // The .layout_version file is responsible for determining whether 4.2 decides up upgrade + // the media folder for multi-user. + if (strcmp(de->d_name, "media") == 0 || strcmp(de->d_name, ".layout_version") == 0) continue; sprintf(cmd, "rm -fr /data/%s", de->d_name); system(cmd); } closedir(d); + ui_print("Done.\n"); + return true; } - ui_print("Done.\n"); - return true; + ui_print("Dirent failed to open /data, error!\n"); + return false; } bool TWPartition::Backup_Tar(string backup_folder) { |