diff options
Diffstat (limited to '')
-rw-r--r-- | gui/action.cpp | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/gui/action.cpp b/gui/action.cpp index 656c687b9..e13d15c68 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -792,25 +792,27 @@ int GUIAction::generatebackupname(std::string arg __unused) return 0; } -int GUIAction::checkpartitionlist(std::string arg __unused) +int GUIAction::checkpartitionlist(std::string arg) { - string Wipe_List, wipe_path; + string List, part_path; int count = 0; - DataManager::GetValue("tw_wipe_list", Wipe_List); - LOGINFO("checkpartitionlist list '%s'\n", Wipe_List.c_str()); - if (!Wipe_List.empty()) { - size_t start_pos = 0, end_pos = Wipe_List.find(";", start_pos); - while (end_pos != string::npos && start_pos < Wipe_List.size()) { - wipe_path = Wipe_List.substr(start_pos, end_pos - start_pos); - LOGINFO("checkpartitionlist wipe_path '%s'\n", wipe_path.c_str()); - if (wipe_path == "/and-sec" || wipe_path == "DALVIK" || wipe_path == "INTERNAL") { + if (arg.empty()) + arg = "tw_wipe_list"; + DataManager::GetValue(arg, List); + LOGINFO("checkpartitionlist list '%s'\n", List.c_str()); + if (!List.empty()) { + size_t start_pos = 0, end_pos = List.find(";", start_pos); + while (end_pos != string::npos && start_pos < List.size()) { + part_path = List.substr(start_pos, end_pos - start_pos); + LOGINFO("checkpartitionlist part_path '%s'\n", part_path.c_str()); + if (part_path == "/and-sec" || part_path == "DALVIK" || part_path == "INTERNAL") { // Do nothing } else { count++; } start_pos = end_pos + 1; - end_pos = Wipe_List.find(";", start_pos); + end_pos = List.find(";", start_pos); } DataManager::SetValue("tw_check_partition_list", count); } else { @@ -819,29 +821,32 @@ int GUIAction::checkpartitionlist(std::string arg __unused) return 0; } -int GUIAction::getpartitiondetails(std::string arg __unused) +int GUIAction::getpartitiondetails(std::string arg) { - string Wipe_List, wipe_path; + string List, part_path; int count = 0; - DataManager::GetValue("tw_wipe_list", Wipe_List); - LOGINFO("getpartitiondetails list '%s'\n", Wipe_List.c_str()); - if (!Wipe_List.empty()) { - size_t start_pos = 0, end_pos = Wipe_List.find(";", start_pos); - while (end_pos != string::npos && start_pos < Wipe_List.size()) { - wipe_path = Wipe_List.substr(start_pos, end_pos - start_pos); - LOGINFO("getpartitiondetails wipe_path '%s'\n", wipe_path.c_str()); - if (wipe_path == "/and-sec" || wipe_path == "DALVIK" || wipe_path == "INTERNAL") { + if (arg.empty()) + arg = "tw_wipe_list"; + DataManager::GetValue(arg, List); + LOGINFO("getpartitiondetails list '%s'\n", List.c_str()); + if (!List.empty()) { + size_t start_pos = 0, end_pos = List.find(";", start_pos); + part_path = List; + while (end_pos != string::npos && start_pos < List.size()) { + part_path = List.substr(start_pos, end_pos - start_pos); + LOGINFO("getpartitiondetails part_path '%s'\n", part_path.c_str()); + if (part_path == "/and-sec" || part_path == "DALVIK" || part_path == "INTERNAL") { // Do nothing } else { - DataManager::SetValue("tw_partition_path", wipe_path); + DataManager::SetValue("tw_partition_path", part_path); break; } start_pos = end_pos + 1; - end_pos = Wipe_List.find(";", start_pos); + end_pos = List.find(";", start_pos); } - if (!wipe_path.empty()) { - TWPartition* Part = PartitionManager.Find_Partition_By_Path(wipe_path); + if (!part_path.empty()) { + TWPartition* Part = PartitionManager.Find_Partition_By_Path(part_path); if (Part) { unsigned long long mb = 1048576; @@ -881,12 +886,14 @@ int GUIAction::getpartitiondetails(std::string arg __unused) DataManager::SetValue("tw_partition_ext", 0); return 0; } else { - LOGERR("Unable to locate partition: '%s'\n", wipe_path.c_str()); + LOGERR("Unable to locate partition: '%s'\n", part_path.c_str()); } } } DataManager::SetValue("tw_partition_name", ""); DataManager::SetValue("tw_partition_file_system", ""); + // Set this to 0 to prevent trying to partition this device, just in case + DataManager::SetValue("tw_partition_removable", 0); return 0; } |