mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-23 10:03:43 +08:00
fix 创建快捷方式 微软版
This commit is contained in:
parent
790f801fe0
commit
9809829903
@ -48,8 +48,6 @@ class AppConf {
|
|||||||
|
|
||||||
static const gameChannels = ["LIVE", "PTU", "EPTU"];
|
static const gameChannels = ["LIVE", "PTU", "EPTU"];
|
||||||
|
|
||||||
static const appShortCutName = "SC汉化盒子${AppConf.isMSE ? "" : "DEV"}.lnk";
|
|
||||||
|
|
||||||
static late final String applicationSupportDir;
|
static late final String applicationSupportDir;
|
||||||
|
|
||||||
static AppVersionData? networkVersionData;
|
static AppVersionData? networkVersionData;
|
||||||
|
@ -151,10 +151,16 @@ class SettingUIModel extends BaseUIModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> addShortCut() async {
|
Future<void> addShortCut() async {
|
||||||
|
if (AppConf.isMSE) {
|
||||||
|
showToast(context!, "因微软版功能限制,请在接下来打开的窗口中 手动将《SC汉化盒子》拖动到桌面,即可创建快捷方式。");
|
||||||
|
await Future.delayed(const Duration(seconds: 1));
|
||||||
|
Process.run("explorer.exe", ["shell:AppsFolder"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
dPrint(Platform.resolvedExecutable);
|
dPrint(Platform.resolvedExecutable);
|
||||||
final script = """
|
final script = """
|
||||||
\$targetPath = "${Platform.resolvedExecutable}";
|
\$targetPath = "${Platform.resolvedExecutable}";
|
||||||
\$shortcutPath = [System.IO.Path]::Combine([System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::DesktopDirectory), "${AppConf.appShortCutName}");
|
\$shortcutPath = [System.IO.Path]::Combine([System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::DesktopDirectory), "SC汉化盒子DEV.lnk");
|
||||||
\$shell = New-Object -ComObject WScript.Shell
|
\$shell = New-Object -ComObject WScript.Shell
|
||||||
\$shortcut = \$shell.CreateShortcut(\$shortcutPath)
|
\$shortcut = \$shell.CreateShortcut(\$shortcutPath)
|
||||||
if (\$shortcut -eq \$null) {
|
if (\$shortcut -eq \$null) {
|
||||||
@ -165,9 +171,7 @@ class SettingUIModel extends BaseUIModel {
|
|||||||
Write-Host "Shortcut created successfully."
|
Write-Host "Shortcut created successfully."
|
||||||
}
|
}
|
||||||
""";
|
""";
|
||||||
final r = await Process.run(SystemHelper.powershellPath, [script]);
|
await Process.run(SystemHelper.powershellPath, [script]);
|
||||||
dPrint(r.exitCode);
|
showToast(context!, "创建完毕,请返回桌面查看");
|
||||||
dPrint(r.stdout);
|
|
||||||
dPrint(r.stderr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user