mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-23 05:23:44 +08:00
fix:powershell auto select
This commit is contained in:
parent
3c174dcb49
commit
5e67211685
16
lib/app.dart
16
lib/app.dart
@ -120,6 +120,11 @@ class AppGlobalModel extends _$AppGlobalModel {
|
|||||||
applicationBinaryModuleDir: applicationBinaryModuleDir,
|
applicationBinaryModuleDir: applicationBinaryModuleDir,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// init Rust bridge
|
||||||
|
await RustLib.init();
|
||||||
|
await RSHttp.init();
|
||||||
|
dPrint("---- rust bridge init -----");
|
||||||
|
|
||||||
// init Hive
|
// init Hive
|
||||||
try {
|
try {
|
||||||
Hive.init("$applicationSupportDir/db");
|
Hive.init("$applicationSupportDir/db");
|
||||||
@ -144,13 +149,13 @@ class AppGlobalModel extends _$AppGlobalModel {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// init Rust bridge
|
|
||||||
await RustLib.init();
|
|
||||||
await RSHttp.init();
|
|
||||||
dPrint("---- rust bridge inited -----");
|
|
||||||
|
|
||||||
// init powershell
|
// init powershell
|
||||||
|
try {
|
||||||
await SystemHelper.initPowershellPath();
|
await SystemHelper.initPowershellPath();
|
||||||
|
dPrint("---- Powershell init -----");
|
||||||
|
}catch (e){
|
||||||
|
dPrint("powershell init failed : $e");
|
||||||
|
}
|
||||||
|
|
||||||
// get windows info
|
// get windows info
|
||||||
WindowsDeviceInfo? windowsDeviceInfo;
|
WindowsDeviceInfo? windowsDeviceInfo;
|
||||||
@ -177,6 +182,7 @@ class AppGlobalModel extends _$AppGlobalModel {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dPrint("---- Window init -----");
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
ref.keepAlive();
|
ref.keepAlive();
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,13 @@ class SystemHelper {
|
|||||||
static String powershellPath = "powershell.exe";
|
static String powershellPath = "powershell.exe";
|
||||||
|
|
||||||
static initPowershellPath() async {
|
static initPowershellPath() async {
|
||||||
|
try {
|
||||||
var result = await Process.run(powershellPath, ["echo", "ping"]);
|
var result = await Process.run(powershellPath, ["echo", "ping"]);
|
||||||
if (!result.stdout.toString().startsWith("ping") &&
|
if (!result.stdout.toString().startsWith("ping") &&
|
||||||
powershellPath == "powershell.exe") {
|
powershellPath == "powershell.exe") {
|
||||||
|
throw "powershell check failed";
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
Map<String, String> envVars = Platform.environment;
|
Map<String, String> envVars = Platform.environment;
|
||||||
final systemRoot = envVars["SYSTEMROOT"];
|
final systemRoot = envVars["SYSTEMROOT"];
|
||||||
if (systemRoot != null) {
|
if (systemRoot != null) {
|
||||||
@ -17,7 +21,6 @@ class SystemHelper {
|
|||||||
"$systemRoot\\System32\\WindowsPowerShell\\v1.0\\powershell.exe";
|
"$systemRoot\\System32\\WindowsPowerShell\\v1.0\\powershell.exe";
|
||||||
dPrint("auto search powershell path === $autoSearchPath");
|
dPrint("auto search powershell path === $autoSearchPath");
|
||||||
powershellPath = autoSearchPath;
|
powershellPath = autoSearchPath;
|
||||||
initPowershellPath();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,11 +12,11 @@ void dPrint(src) async {
|
|||||||
if (kDebugMode) {
|
if (kDebugMode) {
|
||||||
print(src);
|
print(src);
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
await _logLock.synchronized(() async {
|
await _logLock.synchronized(() async {
|
||||||
|
try {
|
||||||
_logFile?.writeAsString("$src\n", mode: FileMode.append);
|
_logFile?.writeAsString("$src\n", mode: FileMode.append);
|
||||||
});
|
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDPrintFile(File file) {
|
void setDPrintFile(File file) {
|
||||||
|
@ -69,8 +69,10 @@ class SplashUI extends HookConsumerWidget {
|
|||||||
}
|
}
|
||||||
stepState.value = 1;
|
stepState.value = 1;
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
|
dPrint("_initApp checkUpdate");
|
||||||
await appModel.checkUpdate(context);
|
await appModel.checkUpdate(context);
|
||||||
stepState.value = 2;
|
stepState.value = 2;
|
||||||
|
dPrint("_initApp aria2cModelProvider");
|
||||||
ref.read(aria2cModelProvider);
|
ref.read(aria2cModelProvider);
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
context.go("/index");
|
context.go("/index");
|
||||||
|
Loading…
Reference in New Issue
Block a user