From 88770edc1b796b8b156ea7e4373b9ded4f9e1683 Mon Sep 17 00:00:00 2001 From: "leedongmyung[desktop]" Date: Sun, 29 Oct 2023 12:44:03 +0900 Subject: [PATCH] =?UTF-8?q?=EB=94=94=EB=B2=84=EA=B7=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/cli/commands/command_install.dart | 4 +-- lib/cli/commands/install/regist_path.dart | 35 +++++++++++++++-------- 2 files changed, 25 insertions(+), 14 deletions(-) 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; } }