mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-03-11 17:25:32 +00:00
fix: update directory handling for macOS
This commit is contained in:
parent
f7887dd0dc
commit
a8f78d41fb
2 changed files with 14 additions and 6 deletions
|
|
@ -101,7 +101,15 @@ Future<void> _postLaunchInit(StorageProvider storage) async {
|
|||
Future<void> _migrateOldLayout() async {
|
||||
if (!(Platform.isIOS || Platform.isMacOS)) return;
|
||||
final root = await getApplicationDocumentsDirectory();
|
||||
final oldRoot = Directory(p.join(root.path, 'Mangayomi'));
|
||||
final rootM = Directory(p.join(root.path, 'Mangayomi'));
|
||||
if (Platform.isIOS) {
|
||||
await _migrateOld(rootM, root);
|
||||
} else {
|
||||
await _migrateOld(root, rootM);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _migrateOld(Directory oldRoot, Directory root) async {
|
||||
if (!await oldRoot.exists()) return;
|
||||
final newDbDir = Directory(p.join(root.path, 'databases'));
|
||||
await newDbDir.create(recursive: true);
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ class StorageProvider {
|
|||
directory = Directory("/storage/emulated/0/Mangayomi/");
|
||||
} else {
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
// The documents dir in iOS and macOS is already named "Mangayomi".
|
||||
// The documents dir in iOS is already named "Mangayomi".
|
||||
// Appending "Mangayomi" to the documents dir would create
|
||||
// unnecessarily nested Mangayomi/Mangayomi/ folder.
|
||||
if (Platform.isIOS || Platform.isMacOS) return dir;
|
||||
if (Platform.isIOS) return dir;
|
||||
directory = Directory(path.join(dir.path, 'Mangayomi'));
|
||||
}
|
||||
return directory;
|
||||
|
|
@ -114,10 +114,10 @@ class StorageProvider {
|
|||
} else {
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
final p = dPath.isEmpty ? dir.path : dPath;
|
||||
// The documents dir in iOS and macOS is already named "Mangayomi".
|
||||
// The documents dir in iOS is already named "Mangayomi".
|
||||
// Appending "Mangayomi" to the documents dir would create
|
||||
// unnecessarily nested Mangayomi/Mangayomi/ folder.
|
||||
if (Platform.isIOS || Platform.isMacOS) return Directory(p);
|
||||
if (Platform.isIOS) return Directory(p);
|
||||
directory = Directory(path.join(p, 'Mangayomi'));
|
||||
}
|
||||
return directory;
|
||||
|
|
@ -163,7 +163,7 @@ class StorageProvider {
|
|||
final dir = await getApplicationDocumentsDirectory();
|
||||
String dbDir;
|
||||
if (Platform.isAndroid) return dir;
|
||||
if (Platform.isIOS || Platform.isMacOS) {
|
||||
if (Platform.isIOS) {
|
||||
// Put the database files inside /databases like on Windows, Linux
|
||||
// So they are not just in the app folders root dir
|
||||
dbDir = path.join(dir.path, 'databases');
|
||||
|
|
|
|||
Loading…
Reference in a new issue