update path
This commit is contained in:
parent
86c7de1d9a
commit
37a9608b8d
2 changed files with 8 additions and 7 deletions
|
|
@ -6,18 +6,18 @@ import 'package:path/path.dart' as path;
|
|||
enum FileType { none, file, directory, link }
|
||||
|
||||
class Path {
|
||||
static Future<String> get userPath async {
|
||||
static String get userPath {
|
||||
String path = '';
|
||||
if (Platform.isWindows) {
|
||||
path = Platform.environment['USERPROFILE'] as String;
|
||||
} else if (Platform.isMacOS || Platform.isLinux) {
|
||||
path = Platform.environment['HOME'] as String;
|
||||
}
|
||||
return dataFutrue(path);
|
||||
return path;
|
||||
}
|
||||
|
||||
static Future<String> get dataPath async {
|
||||
String path = await userPath;
|
||||
static String get dataPath {
|
||||
String path = userPath;
|
||||
if (Platform.isMacOS) {
|
||||
path = '$path/Library/$appIdendifier';
|
||||
} else if (Platform.isLinux) {
|
||||
|
|
@ -26,7 +26,7 @@ class Path {
|
|||
path = '$path/AppData/Local/$appIdendifier';
|
||||
}
|
||||
if (Platform.isWindows) path = path.replaceAll('/', '\\');
|
||||
return dataFutrue(path);
|
||||
return path;
|
||||
}
|
||||
|
||||
static String? getParent(String path) {
|
||||
|
|
|
|||
|
|
@ -25,8 +25,9 @@ Future initialize(String name, String appID) async {
|
|||
executablePath = Platform.executable;
|
||||
isDebug =
|
||||
path.basenameWithoutExtension(Platform.resolvedExecutable) == 'dart';
|
||||
userPath = await Path.userPath;
|
||||
dataPath = await Path.dataPath;
|
||||
var debugPath = isDebug ? '.debug' : '';
|
||||
userPath = Path.userPath;
|
||||
dataPath = '${Path.dataPath}$debugPath';
|
||||
}
|
||||
|
||||
Map<String, List<String>?> envArguments(List<String> arguments) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue