diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 9775c5f95..dff23a199 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -47,6 +47,7 @@ "SABnzbd", "scrollview", "sksl", + "snapcraft", "Sonarr", "stickied", "subheaders", diff --git a/lib/core/database/database.dart b/lib/core/database/database.dart index 289a8b9eb..df5bf7c38 100644 --- a/lib/core/database/database.dart +++ b/lib/core/database/database.dart @@ -1,8 +1,10 @@ import 'package:lunasea/core.dart'; -export 'package:hive_flutter/hive_flutter.dart'; + +import '../system/platform.dart'; class Database { - static const String _DATABASE_PATH = 'database'; + static const String _DATABASE_LEGACY_PATH = 'database'; + static const String _DATABASE_PATH = 'LunaSea/database'; static late _BoxManager alerts; static late _BoxManager externalModules; @@ -11,8 +13,16 @@ class Database { static late _BoxManager lunasea; static late _BoxManager profiles; + String get _databasePath { + final platform = LunaPlatform(); + if (platform.isWindows || platform.isLinux) + return _DATABASE_PATH; + else + return _DATABASE_LEGACY_PATH; + } + Future initialize() async { - await Hive.initFlutter(_DATABASE_PATH); + await Hive.initFlutter(_databasePath); LunaDatabase().registerAdapters(); LunaModule.values.forEach((module) => module.database?.registerAdapters()); diff --git a/lib/modules/dashboard/core/database.dart b/lib/modules/dashboard/core/database.dart index 31192eb31..d917a7afc 100644 --- a/lib/modules/dashboard/core/database.dart +++ b/lib/modules/dashboard/core/database.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import '../../../core/database/database.dart'; import '../../../core/database/module_database.dart'; import '../../../core/utilities/logger.dart'; +import '../../../vendor.dart'; import 'adapters/calendar_starting_day.dart'; import 'adapters/calendar_starting_size.dart'; import 'adapters/calendar_starting_type.dart';