디버그

This commit is contained in:
leedongmyung[desktop] 2023-10-29 12:44:03 +09:00
parent a051432b33
commit 88770edc1b
2 changed files with 25 additions and 14 deletions

View file

@ -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);

View file

@ -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;
}
}