From ed63c7ba3ecbcdd692fb0f7ae96679e50927a254 Mon Sep 17 00:00:00 2001 From: CodeDoctorDE Date: Tue, 26 Dec 2023 09:18:07 +0100 Subject: [PATCH] Fix moving data directory, closes #562 --- app/lib/api/file_system/file_system_io.dart | 7 ++++--- fastlane/metadata/android/en-US/changelogs/86.txt | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/lib/api/file_system/file_system_io.dart b/app/lib/api/file_system/file_system_io.dart index f5171305b345..41d687eb25cb 100644 --- a/app/lib/api/file_system/file_system_io.dart +++ b/app/lib/api/file_system/file_system_io.dart @@ -152,15 +152,16 @@ class IODocumentFileSystem extends DocumentFileSystem { if (await oldDirectory.exists()) { var files = await oldDirectory.list().toList(); for (final file in files) { + final newEntityPath = '$newPath/${file.path.substring(oldPath.length)}'; if (file is File) { - var newFile = File('$newPath/${file.path.split('/').last}'); + var newFile = File(newEntityPath); final content = await file.readAsBytes(); + await newFile.parent.create(recursive: true); await newFile.create(recursive: true); await newFile.writeAsBytes(content); await file.delete(); } else if (file is Directory) { - await moveAbsolute( - file.path, '$newPath/${file.path.split('/').last}'); + await moveAbsolute(file.path, newEntityPath); } } } diff --git a/fastlane/metadata/android/en-US/changelogs/86.txt b/fastlane/metadata/android/en-US/changelogs/86.txt index 0e075982eed5..422b6e7e8382 100644 --- a/fastlane/metadata/android/en-US/changelogs/86.txt +++ b/fastlane/metadata/android/en-US/changelogs/86.txt @@ -1 +1,2 @@ -* Add support for multi character input languages ([#539](https://github.com/LinwoodDev/Butterfly/issues/539)) \ No newline at end of file +* Add support for multi character input languages ([#539](https://github.com/LinwoodDev/Butterfly/issues/539)) +* Fix moving data directory ([#562](https://github.com/LinwoodDev/Butterfly/issues/562)) \ No newline at end of file