-
Notifications
You must be signed in to change notification settings - Fork 971
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
1,369 additions
and
458 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dart run msix:create --release -v --output-path build/windows/runner --output-name AIdea |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import 'dart:io' show Directory, Platform; | ||
import 'package:askaide/helper/platform.dart'; | ||
import 'package:path_provider/path_provider.dart'; | ||
|
||
class PathHelper { | ||
late final String cachePath; | ||
late final String documentsPath; | ||
late final String supportPath; | ||
|
||
init() async { | ||
try { | ||
cachePath = | ||
(await getApplicationCacheDirectory()).path.replaceAll('\\', '/'); | ||
} catch (e) { | ||
cachePath = ''; | ||
} | ||
|
||
try { | ||
documentsPath = | ||
(await getApplicationDocumentsDirectory()).path.replaceAll('\\', '/'); | ||
} catch (e) { | ||
documentsPath = ''; | ||
} | ||
|
||
try { | ||
supportPath = | ||
(await getApplicationSupportDirectory()).path.replaceAll('\\', '/'); | ||
} catch (e) { | ||
supportPath = ''; | ||
} | ||
|
||
// 确保 .aidea 目录存在 | ||
try { | ||
Directory(getHomePath).create(recursive: true); | ||
} catch (e) { | ||
print('创建 $getHomePath 目录失败: $e'); | ||
} | ||
} | ||
|
||
String get getHomePath { | ||
Map<String, String> envVars = Platform.environment; | ||
if (PlatformTool.isMacOS() || PlatformTool.isLinux()) { | ||
return '${envVars['HOME'] ?? ''}/.aidea'.replaceAll('\\', '/'); | ||
} else if (PlatformTool.isWindows()) { | ||
return '${envVars['UserProfile'] ?? ''}/.aidea'.replaceAll('\\', '/'); | ||
} else if (PlatformTool.isAndroid() || PlatformTool.isIOS()) { | ||
return '$documentsPath/.aidea'.replaceAll('\\', '/'); | ||
} | ||
|
||
return '.aidea'; | ||
} | ||
|
||
String get getLogfilePath { | ||
return '$getHomePath/aidea.log'; | ||
} | ||
|
||
String get getCachePath { | ||
return getHomePath; | ||
} | ||
|
||
/// 单例 | ||
static final PathHelper _instance = PathHelper._internal(); | ||
PathHelper._internal(); | ||
|
||
factory PathHelper() { | ||
return _instance; | ||
} | ||
|
||
Map<String, String> toMap() { | ||
return { | ||
'cachePath': cachePath, | ||
'cachePathReal': getCachePath, | ||
'documentsPath': documentsPath, | ||
'supportPath': supportPath, | ||
'homePath': getHomePath, | ||
'logfilePath': getLogfilePath, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.