Skip to content

Commit

Permalink
修复安装路径存在空格导致的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mujianwu committed Nov 19, 2024
1 parent ddc20a0 commit dd4c397
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 14 deletions.
9 changes: 5 additions & 4 deletions UotanToolbox/Common/FeaturesHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Globalization;
using System.IO;
using System.Resources;
using System.Threading.Tasks;

Expand All @@ -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");
Expand All @@ -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\"");
Expand Down
8 changes: 4 additions & 4 deletions UotanToolbox/Features/Basicflash/BasicflashView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
4 changes: 2 additions & 2 deletions UotanToolbox/Features/Home/HomeView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion UotanToolbox/Features/Home/HomeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion UotanToolbox/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"))
Expand Down

0 comments on commit dd4c397

Please sign in to comment.