mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
fix #110
This commit is contained in:
@@ -153,6 +153,15 @@ class LocalManager with ChangeNotifier {
|
|||||||
|
|
||||||
Directory get directory => Directory(path);
|
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
|
// return error message if failed
|
||||||
Future<String?> setNewPath(String newPath) async {
|
Future<String?> setNewPath(String newPath) async {
|
||||||
var newDir = Directory(newPath);
|
var newDir = Directory(newPath);
|
||||||
@@ -174,6 +183,7 @@ class LocalManager with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
await directory.deleteContents(recursive: true);
|
await directory.deleteContents(recursive: true);
|
||||||
path = newPath;
|
path = newPath;
|
||||||
|
_checkNoMedia();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,6 +243,7 @@ class LocalManager with ChangeNotifier {
|
|||||||
catch(e, s) {
|
catch(e, s) {
|
||||||
Log.error("IO", "Failed to create local folder: $e", s);
|
Log.error("IO", "Failed to create local folder: $e", s);
|
||||||
}
|
}
|
||||||
|
_checkNoMedia();
|
||||||
restoreDownloadingTasks();
|
restoreDownloadingTasks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user