diff --git a/UotanToolbox/Common/FeaturesHelper.cs b/UotanToolbox/Common/FeaturesHelper.cs index 52f1b31c..78229c21 100644 --- a/UotanToolbox/Common/FeaturesHelper.cs +++ b/UotanToolbox/Common/FeaturesHelper.cs @@ -1,4 +1,5 @@ using System.Globalization; +using System.IO; using System.Resources; using System.Threading.Tasks; @@ -18,15 +19,15 @@ public static string GetTranslation(string key) public static async void PushMakefs(string device) { - _ = await CallExternalProgram.ADB($"-s {device} push {Global.runpath}/Push/mkfs.f2fs /tmp/"); + _ = await CallExternalProgram.ADB($"-s {device} push \"{Path.Combine(Global.runpath, "Push", "mkfs.f2fs")}\" /tmp/"); _ = await CallExternalProgram.ADB($"-s {device} shell chmod +x /tmp/mkfs.f2fs"); - _ = await CallExternalProgram.ADB($"-s {device} push {Global.runpath}/Push/mkntfs /tmp/"); + _ = await CallExternalProgram.ADB($"-s {device} push \"{Path.Combine(Global.runpath, "Push", "mkntfs")}\" /tmp/"); _ = await CallExternalProgram.ADB($"-s {device} shell chmod +x /tmp/mkntfs"); } public static async Task GetPartTable(string device) { - _ = await CallExternalProgram.ADB($"-s {device} push {Global.runpath}/Push/parted /tmp/"); + _ = await CallExternalProgram.ADB($"-s {device} push \"{Path.Combine(Global.runpath, "Push", "parted")}\" /tmp/"); _ = await CallExternalProgram.ADB($"-s {device} shell chmod +x /tmp/parted"); Global.sdatable = await CallExternalProgram.ADB($"-s {device} shell /tmp/parted /dev/block/sda print"); Global.sdbtable = await CallExternalProgram.ADB($"-s {device} shell /tmp/parted /dev/block/sdb print"); @@ -39,7 +40,7 @@ public static async Task GetPartTable(string device) public static async Task GetPartTableSystem(string device) { - _ = await CallExternalProgram.ADB($"-s {device} push {Global.runpath}/Push/parted /data/local/tmp/"); + _ = await CallExternalProgram.ADB($"-s {device} push \"{Path.Combine(Global.runpath, "Push", "parted")}\" /data/local/tmp/"); _ = await CallExternalProgram.ADB($"-s {device} shell su -c \"chmod +x /data/local/tmp/parted\""); Global.sdatable = await CallExternalProgram.ADB($"-s {device} shell su -c \"/data/local/tmp/parted /dev/block/sda print\""); Global.sdbtable = await CallExternalProgram.ADB($"-s {device} shell su -c \"/data/local/tmp/parted /dev/block/sdb print\""); diff --git a/UotanToolbox/Features/Basicflash/BasicflashView.axaml.cs b/UotanToolbox/Features/Basicflash/BasicflashView.axaml.cs index 16ac6935..e17ada80 100644 --- a/UotanToolbox/Features/Basicflash/BasicflashView.axaml.cs +++ b/UotanToolbox/Features/Basicflash/BasicflashView.axaml.cs @@ -303,7 +303,7 @@ private async Task FlashRec(string shell) output = await CallExternalProgram.Fastboot($"-s {Global.thisdevice} oem reboot-recovery"); if (output.Contains("unknown command")) { - await CallExternalProgram.Fastboot($"-s {Global.thisdevice} flash misc {Global.runpath}/Image/misc.img"); + await CallExternalProgram.Fastboot($"-s {Global.thisdevice} flash misc \"{Path.Combine(Global.runpath, "Image", "misc.img")}\""); await CallExternalProgram.Fastboot($"-s {Global.thisdevice} reboot"); } }, true) @@ -692,7 +692,7 @@ private async void FlashMagisk(object sender, RoutedEventArgs args) { if (sukiViewModel.Status == "Recovery") { - _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} push {MagiskFile.Text} /tmp/magisk.apk"); + _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} push \"{MagiskFile.Text}\" /tmp/magisk.apk"); _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} shell twrp install /tmp/magisk.apk"); } else @@ -807,7 +807,7 @@ private async void DisableOffRec(object sender, RoutedEventArgs args) { if (sukiViewModel.Status == "Recovery") { - _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} push {Global.runpath}/ZIP/DisableAutoRecovery.zip /tmp/"); + _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} push \"{Path.Combine(Global.runpath, "ZIP", "DisableAutoRecovery.zip")}\" /tmp/"); _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} shell twrp install /tmp/DisableAutoRecovery.zip"); } else @@ -877,7 +877,7 @@ private async void SyncAB(object sender, RoutedEventArgs args) { if (sukiViewModel.Status == "Recovery") { - _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} push {Global.runpath}/ZIP/copy-partitions.zip /tmp/"); + _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} push \"{Path.Combine(Global.runpath, "ZIP", "copy-partitions.zip")}\" /tmp/"); _ = await CallExternalProgram.ADB($"-s {Global.thisdevice} shell twrp install /tmp/copy-partitions.zip"); } else diff --git a/UotanToolbox/Features/Customizedflash/CustomizedflashView.axaml.cs b/UotanToolbox/Features/Customizedflash/CustomizedflashView.axaml.cs index b9fcc5d1..3830d87a 100644 --- a/UotanToolbox/Features/Customizedflash/CustomizedflashView.axaml.cs +++ b/UotanToolbox/Features/Customizedflash/CustomizedflashView.axaml.cs @@ -630,7 +630,7 @@ private async void DisableVbmeta(object sender, RoutedEventArgs args) if (sukiViewModel.Status == GetTranslation("Home_Fastboot") || sukiViewModel.Status == GetTranslation("Home_Fastbootd")) { CustomizedflashLog.Text = ""; - string shell = string.Format($"-s {Global.thisdevice} --disable-verity --disable-verification flash vbmeta {Global.runpath}/Image/vbmeta.img"); + string shell = string.Format($"-s {Global.thisdevice} --disable-verity --disable-verification flash vbmeta \"{Path.Combine(Global.runpath, "Image", "vbmeta.img")}\""); await Fastboot(shell); } else diff --git a/UotanToolbox/Features/FormatExtract/FormatExtractView.axaml.cs b/UotanToolbox/Features/FormatExtract/FormatExtractView.axaml.cs index f22796ec..f2f85b78 100644 --- a/UotanToolbox/Features/FormatExtract/FormatExtractView.axaml.cs +++ b/UotanToolbox/Features/FormatExtract/FormatExtractView.axaml.cs @@ -308,7 +308,7 @@ private async void Enable9091(object sender, RoutedEventArgs args) { BusyQCN.IsBusy = true; QCN.IsEnabled = false; - await CallExternalProgram.ADB($"-s {Global.thisdevice} push APK/mi_diag.apk /sdcard"); + await CallExternalProgram.ADB($"-s {Global.thisdevice} push \"{Path.Combine(Global.runpath, "APK", "mi_diag.apk")}\" /sdcard"); await CallExternalProgram.ADB($"-s {Global.thisdevice} shell \"am start -a miui.intent.action.OPEN\""); Global.MainDialogManager.CreateDialog() .WithTitle(GetTranslation("Common_Error")) diff --git a/UotanToolbox/Features/Home/HomeView.axaml.cs b/UotanToolbox/Features/Home/HomeView.axaml.cs index 77463df0..da49df1a 100644 --- a/UotanToolbox/Features/Home/HomeView.axaml.cs +++ b/UotanToolbox/Features/Home/HomeView.axaml.cs @@ -92,7 +92,7 @@ private async void OpenAFDI(object sender, RoutedEventArgs args) } else if (RuntimeInformation.OSArchitecture == Architecture.Arm64) { - string drvpath = String.Format($"{Global.runpath}/Drive/adb/*.inf"); + string drvpath = String.Format($"\"{Path.Combine(Global.runpath, "Drive", "adb", "*.inf")}\""); string shell = String.Format("/add-driver {0} /subdirs /install", drvpath); string drvlog = await CallExternalProgram.Pnputil(shell); FileHelper.Write($"{Global.log_path}/drive.txt", drvlog); @@ -122,7 +122,7 @@ private async void Open9008DI(object sender, RoutedEventArgs args) } else if (RuntimeInformation.OSArchitecture == Architecture.Arm64) { - string drvpath = String.Format($"{Global.runpath}/drive/9008/*.inf"); + string drvpath = String.Format($"\"{Path.Combine(Global.runpath, "Drive", "9008", "*.inf")}\""); string shell = String.Format("/add-driver {0} /subdirs /install", drvpath); string drvlog = await CallExternalProgram.Pnputil(shell); FileHelper.Write($"{Global.log_path}/drive.txt", drvlog); diff --git a/UotanToolbox/Features/Home/HomeViewModel.cs b/UotanToolbox/Features/Home/HomeViewModel.cs index f9ac9c57..0ae32c68 100644 --- a/UotanToolbox/Features/Home/HomeViewModel.cs +++ b/UotanToolbox/Features/Home/HomeViewModel.cs @@ -9,6 +9,7 @@ using SukiUI.Toasts; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Net.Http; using System.Threading.Tasks; @@ -293,7 +294,7 @@ public async Task RebootRec() string output = await CallExternalProgram.Fastboot($"-s {Global.thisdevice} oem reboot-recovery"); if (output.Contains("unknown command")) { - _ = await CallExternalProgram.Fastboot($"-s {Global.thisdevice} flash misc {Global.runpath}/Image/misc.img"); + _ = await CallExternalProgram.Fastboot($"-s {Global.thisdevice} flash misc \"{Path.Combine(Global.runpath, "Image", "misc.img")}\""); _ = await CallExternalProgram.Fastboot($"-s {Global.thisdevice} reboot"); } else diff --git a/UotanToolbox/MainViewModel.cs b/UotanToolbox/MainViewModel.cs index 836aa084..31f4f555 100644 --- a/UotanToolbox/MainViewModel.cs +++ b/UotanToolbox/MainViewModel.cs @@ -10,6 +10,7 @@ using SukiUI.Toasts; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Threading.Tasks; using UotanToolbox.Common; @@ -163,7 +164,7 @@ public async Task RebootRec() string output = await CallExternalProgram.Fastboot($"-s {Global.thisdevice} oem reboot-recovery"); if (output.Contains("unknown command")) { - await CallExternalProgram.Fastboot($"-s {Global.thisdevice} flash misc {Global.runpath}/Image/misc.img"); + await CallExternalProgram.Fastboot($"-s {Global.thisdevice} flash misc \"{Path.Combine(Global.runpath, "Image", "misc.img")}\""); await CallExternalProgram.Fastboot($"-s {Global.thisdevice} reboot"); } else if (sukiViewModel.Status == GetTranslation("Home_OpenHOS"))