exe path modify

This commit is contained in:
Toki 2024-12-25 17:20:50 +09:00
parent 960e6b766c
commit 6a6df5c8f5

View file

@ -177,12 +177,22 @@ class SchedulerManager {
Future checkStartup() async {
if(!await OSStartup.isRegistedStartup(startupID)) {
List<String> param = [];
var exe = Platform.resolvedExecutable;
if(isDebug) {
param.add(scriptPath);
} else {
//homebrew로
if(exe.startsWith('/usr/local')) {
//intel mac
exe = '/usr/local/bin/${path.basenameWithoutExtension(exe)}';
} else if(exe.startsWith('/opt/homebrew')) {
//sillicon mac
exe = '/opt/homebrew/bin/${path.basenameWithoutExtension(exe)}';
}
}
param.add('scheduler');
param.add('-s');
await OSStartup.registStartup(Platform.resolvedExecutable, startupID, arguments: param);
await OSStartup.registStartup(exe, startupID, arguments: param);
}
return simpleFuture;
}