fix: 修复 FactoryReset 误删用户文件并将应用数据迁移至 Application Support
- 修复 macOS/Windows/Linux 非沙盒下 FactoryReset 递归删除 ~/Documents 导致用户项目源代码丢失的严重 bug,改为仅删除已知应用专属文件/子目录并增加路径安全校验 - 数据库文件从 getApplicationDocumentsDirectory() 迁移到 getApplicationSupportDirectory()(应用专属),含自动迁移逻辑 - 启用 macOS Debug 模式沙盒,使开发环境与生产环境路径行为一致 - 统一迁移 13 处应用数据存储位置(Hive、聊天附件、字体、稍后读同步等)到 Application Support,应用启动时执行一次性迁移 - backup_service.dart 备份文件迁移至 Application Support,getBackupList() 兼容扫描新旧两个路径并去重 - clearCache() 同样修复危险递归清空逻辑 详见 CHANGELOG.md v6.136.0 ~ v6.138.0
This commit is contained in:
@@ -58,7 +58,7 @@ class CacheManagerService {
|
||||
];
|
||||
|
||||
Future<String> _getBasePath() async {
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
final dir = await getApplicationSupportDirectory();
|
||||
return '${dir.path}${Platform.pathSeparator}file_transfer';
|
||||
}
|
||||
|
||||
|
||||
@@ -348,7 +348,7 @@ class CloudCacheService {
|
||||
if (savePath != null) {
|
||||
outputPath = savePath;
|
||||
} else {
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
final dir = await getApplicationSupportDirectory();
|
||||
outputPath =
|
||||
'${dir.path}${Platform.pathSeparator}cloud_cache${Platform.pathSeparator}${record.fileName}';
|
||||
await Directory(outputPath).parent.create(recursive: true);
|
||||
|
||||
Reference in New Issue
Block a user