diff --git a/lib/cli/commands/command_install.dart b/lib/cli/commands/command_install.dart index 1864ab0..1510e47 100644 --- a/lib/cli/commands/command_install.dart +++ b/lib/cli/commands/command_install.dart @@ -29,7 +29,7 @@ class CommandInstall extends CommandBase { await target.copy(installFilePath!); //Regist path - RegistPath.OS?.add(installPath); + await RegistPath.OS?.add(installPath); //Create startup await OSStartup.registStartup(installFilePath, label, @@ -62,7 +62,7 @@ class CommandUninstall extends CommandBase { //To-do: Proccess kill //Regist path - RegistPath.OS?.remove(installPath); + await RegistPath.OS?.remove(installPath); //Remove Installed file var installDir = Directory(installPath); diff --git a/lib/cli/commands/install/regist_path.dart b/lib/cli/commands/install/regist_path.dart index b2b3ab9..8bb2205 100644 --- a/lib/cli/commands/install/regist_path.dart +++ b/lib/cli/commands/install/regist_path.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'package:dart_framework/platform/process.dart'; +import 'package:dart_framework/utils/system_util.dart'; class RegistPath { static RegistPath? _instance; @@ -18,39 +19,49 @@ class RegistPath { return _instance; } - void add(String path) { - _instance?.add(path); + Future add(String path) async { + return await _instance?.add(path); } - void remove(String path) { - _instance?.remove(path); + Future remove(String path) async { + return await _instance?.remove(path); } } class _RegistPathOSX extends RegistPath { @override - void add(String path) {} + Future add(String path) async { + return null; + } @override - void remove(String path) {} + Future remove(String path) async { + return null; + } } class _RegistPathLinux extends RegistPath { @override - void add(String path) {} + Future add(String path) async { + return null; + } @override - void remove(String path) {} + Future remove(String path) async { + return null; + } } class _RegistPathWindows extends RegistPath { @override - void add(String path) { - ProcessExecutor.run(StringBuffer('setx path "%path%;$path"')); + Future add(String path) async { + await ProcessExecutor.run(StringBuffer('setx path "%path%;$path"')); + return simpleFuture; } @override - void remove(String path) { - ProcessExecutor.run(StringBuffer('setx path "%path:$path=%"')); + Future remove(String path) async { + await ProcessExecutor.run(StringBuffer('setx path "%path:$path=%"')); + return simpleFuture; } }