oto/lib/cli/commands/command_const.dart
leedongmyung[desktop] a051432b33 디버깅
2023-10-29 12:33:52 +09:00

70 lines
1.3 KiB
Dart

import 'dart:io';
import 'package:oto_cli/cli/cli.dart';
class CommandConstant {
static _CommandConstantBase? _instance;
// ignore: library_private_types_in_public_api
static _CommandConstantBase? get OS {
if (_instance == null) {
if (Platform.isMacOS) {
_instance = _CommandConstantOSX();
} else if (Platform.isLinux) {
_instance = _CommandConstantLinux();
} else {
_instance = _CommandConstantWindows();
}
}
return _instance;
}
}
class _CommandConstantBase {
String get installPath {
return '';
}
String get installFilePath {
return '';
}
}
class _CommandConstantOSX extends _CommandConstantBase {
@override
String get installPath {
return '';
}
@override
String get installFilePath {
return '';
}
}
class _CommandConstantLinux extends _CommandConstantBase {
@override
String get installPath {
return '';
}
@override
String get installFilePath {
return '';
}
}
class _CommandConstantWindows extends _CommandConstantBase {
final windowRoamingPath = '\\AppData\\Roaming\\';
@override
String get installPath {
var userPath = Platform.environment['UserProfile'];
return '$userPath$windowRoamingPath${CLI.serviceName}\\';
}
@override
String get installFilePath {
return '$installPath${CLI.serviceName}.exe';
;
}
}