fix: store Hive data in the app support directory, not ~/Documents
This commit is contained in:
parent
f57336b7ea
commit
f80315e7c4
3 changed files with 9 additions and 2 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import "package:flutter/material.dart";
|
import "package:flutter/material.dart";
|
||||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||||
import "package:hive_flutter/hive_flutter.dart";
|
import "package:hive_flutter/hive_flutter.dart";
|
||||||
|
import "package:path_provider/path_provider.dart";
|
||||||
|
|
||||||
import "package:smol_mail/data/providers/providers.dart";
|
import "package:smol_mail/data/providers/providers.dart";
|
||||||
import "package:smol_mail/smol/config.dart";
|
import "package:smol_mail/smol/config.dart";
|
||||||
|
|
@ -9,7 +10,12 @@ import "package:smol_mail/presentation/app_widget.dart";
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
await Hive.initFlutter();
|
// Hive.initFlutter() defaults to getApplicationDocumentsDirectory(), which
|
||||||
|
// on Linux resolves to the user's actual ~/Documents folder (XDG_DOCUMENTS_DIR)
|
||||||
|
// rather than app-private storage — getApplicationSupportDirectory() is the
|
||||||
|
// one that's actually sandboxed per-app on every platform.
|
||||||
|
final dataDir = await getApplicationSupportDirectory();
|
||||||
|
Hive.init(dataDir.path);
|
||||||
final store = await SmolStore.open();
|
final store = await SmolStore.open();
|
||||||
applyPresetServer(store);
|
applyPresetServer(store);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -625,7 +625,7 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.9.1"
|
version: "1.9.1"
|
||||||
path_provider:
|
path_provider:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: path_provider
|
name: path_provider
|
||||||
sha256: a7f4874f987173da295a61c181b8ee71dab59b332a486b391babf26a1b884825
|
sha256: a7f4874f987173da295a61c181b8ee71dab59b332a486b391babf26a1b884825
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ dependencies:
|
||||||
flutter_riverpod: ^3.3.2
|
flutter_riverpod: ^3.3.2
|
||||||
intl: ^0.20.3
|
intl: ^0.20.3
|
||||||
share_plus: ^13.3.0
|
share_plus: ^13.3.0
|
||||||
|
path_provider: ^2.1.6
|
||||||
file_picker: ^13.1.0
|
file_picker: ^13.1.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue