This commit is contained in:
2026-07-13 08:16:54 +08:00
parent 404d2a9140
commit fd3a204c81
9 changed files with 224 additions and 744 deletions
+5 -1
View File
@@ -137,6 +137,7 @@ Future<void> upload(SyncItemConfig item, bool needCreateDir) async {
}
Future<void> download(SyncItemConfig item, dav.File cloudArchive) async {
print('Start download: ${cloudArchive.path}');
var cacheDir = await getApplicationCacheDirectory();
var zipPath = join(cacheDir.path, '${item.name}_${cloudArchive.name}');
await _client.read2File(cloudArchive.path!, zipPath);
@@ -144,8 +145,10 @@ Future<void> download(SyncItemConfig item, dav.File cloudArchive) async {
File(zipPath).delete();
var temp = File(join(cacheDir.path, basename(item.path)));
print('Temp path: ${temp.path}');
var fileSystemEntityType = temp.statSync().type;
switch (temp.statSync().type) {
switch (fileSystemEntityType) {
case FileSystemEntityType.directory:
var directory = Directory(item.path);
if (directory.existsSync()) {
@@ -160,6 +163,7 @@ Future<void> download(SyncItemConfig item, dav.File cloudArchive) async {
}
temp.renameSync(item.path);
default:
print('Failed: $fileSystemEntityType');
}
}