This commit is contained in:
2024-12-21 17:51:54 +08:00
parent 6a79f68909
commit 9f67cd0d07

View File

@@ -153,6 +153,15 @@ class LocalManager with ChangeNotifier {
Directory get directory => Directory(path);
void _checkNoMedia() {
if (App.isAndroid) {
var file = File(FilePath.join(path, '.nomedia'));
if (!file.existsSync()) {
file.createSync();
}
}
}
// return error message if failed
Future<String?> setNewPath(String newPath) async {
var newDir = Directory(newPath);
@@ -174,6 +183,7 @@ class LocalManager with ChangeNotifier {
}
await directory.deleteContents(recursive: true);
path = newPath;
_checkNoMedia();
return null;
}
@@ -233,6 +243,7 @@ class LocalManager with ChangeNotifier {
catch(e, s) {
Log.error("IO", "Failed to create local folder: $e", s);
}
_checkNoMedia();
restoreDownloadingTasks();
}