diff options
Diffstat (limited to 'partition.cpp')
-rw-r--r-- | partition.cpp | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/partition.cpp b/partition.cpp index a17a647c4..58db70629 100644 --- a/partition.cpp +++ b/partition.cpp @@ -1013,13 +1013,21 @@ bool TWPartition::Mount(bool Display_Error) { } } - if (Current_File_System == "ntfs" && TWFunc::Path_Exists("/sbin/ntfs-3g")) { + if (Current_File_System == "ntfs" && (TWFunc::Path_Exists("/sbin/ntfs-3g") || TWFunc::Path_Exists("/sbin/mount.ntfs"))) { string cmd; + string Ntfsmount_Binary = ""; + + if (TWFunc::Path_Exists("/sbin/ntfs-3g")) + Ntfsmount_Binary = "ntfs-3g"; + else if (TWFunc::Path_Exists("/sbin/mount.ntfs")) + Ntfsmount_Binary = "mount.ntfs"; + if (Mount_Read_Only) - cmd = "/sbin/ntfs-3g -o ro " + Actual_Block_Device + " " + Mount_Point; + cmd = "/sbin/" + Ntfsmount_Binary + " -o ro " + Actual_Block_Device + " " + Mount_Point; else - cmd = "/sbin/ntfs-3g " + Actual_Block_Device + " " + Mount_Point; + cmd = "/sbin/" + Ntfsmount_Binary + " " + Actual_Block_Device + " " + Mount_Point; LOGINFO("cmd: '%s'\n", cmd.c_str()); + if (TWFunc::Exec_Cmd(cmd) == 0) { return true; } else { @@ -1250,7 +1258,7 @@ bool TWPartition::Can_Repair() { return true; else if (Current_File_System == "f2fs" && TWFunc::Path_Exists("/sbin/fsck.f2fs")) return true; - else if (Current_File_System == "ntfs" && TWFunc::Path_Exists("/sbin/ntfsfix")) + else if (Current_File_System == "ntfs" && (TWFunc::Path_Exists("/sbin/ntfsfix") || TWFunc::Path_Exists("/sbin/fsck.ntfs"))) return true; return false; } @@ -1335,15 +1343,20 @@ bool TWPartition::Repair() { } } if (Current_File_System == "ntfs") { - if (!TWFunc::Path_Exists("/sbin/ntfsfix")) { + string Ntfsfix_Binary; + if (TWFunc::Path_Exists("/sbin/ntfsfix")) + Ntfsfix_Binary = "ntfsfix"; + else if (TWFunc::Path_Exists("/sbin/fsck.ntfs")) + Ntfsfix_Binary = "fsck.ntfs"; + else { gui_msg(Msg(msg::kError, "repair_not_exist={1} does not exist! Cannot repair!")("ntfsfix")); return false; } if (!UnMount(true)) return false; - gui_msg(Msg("reparing=Repairing {1} using {2}...")(Display_Name)("ntfsfix")); + gui_msg(Msg("reparing=Repairing {1} using {2}...")(Display_Name)(Ntfsfix_Binary)); Find_Actual_Block_Device(); - command = "/sbin/ntfsfix " + Actual_Block_Device; + command = "/sbin/" + Ntfsfix_Binary + " " + Actual_Block_Device; LOGINFO("Repair command: %s\n", command.c_str()); if (TWFunc::Exec_Cmd(command) == 0) { gui_msg("done=Done."); @@ -1877,23 +1890,28 @@ bool TWPartition::Wipe_F2FS() { bool TWPartition::Wipe_NTFS() { string command; + string Ntfsmake_Binary; - if (TWFunc::Path_Exists("/sbin/mkntfs")) { - if (!UnMount(true)) - return false; + if (TWFunc::Path_Exists("/sbin/mkntfs")) + Ntfsmake_Binary = "mkntfs"; + else if (TWFunc::Path_Exists("/sbin/mkfs.ntfs")) + Ntfsmake_Binary = "mkfs.ntfs"; + else + return false; - gui_msg(Msg("formating_using=Formatting {1} using {2}...")(Display_Name)("mkntfs")); - Find_Actual_Block_Device(); - command = "mkntfs " + Actual_Block_Device; - if (TWFunc::Exec_Cmd(command) == 0) { - Recreate_AndSec_Folder(); - gui_msg("done=Done."); - return true; - } else { - gui_msg(Msg(msg::kError, "unable_to_wipe=Unable to wipe {1}.")(Display_Name)); - return false; - } + if (!UnMount(true)) + return false; + + gui_msg(Msg("formating_using=Formatting {1} using {2}...")(Display_Name)(Ntfsmake_Binary)); + Find_Actual_Block_Device(); + command = "/sbin/" + Ntfsmake_Binary + " " + Actual_Block_Device; + if (TWFunc::Exec_Cmd(command) == 0) { + Recreate_AndSec_Folder(); + gui_msg("done=Done."); return true; + } else { + gui_msg(Msg(msg::kError, "unable_to_wipe=Unable to wipe {1}.")(Display_Name)); + return false; } return false; } |