mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
fix: windows storing the db in random places (#2680)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cw_core/root_dir.dart';
|
||||
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
||||
|
||||
late Database db;
|
||||
@@ -9,6 +10,9 @@ Future<void> initDb({String? pathOverride}) async {
|
||||
if (Platform.isLinux || Platform.isWindows) {
|
||||
databaseFactory = databaseFactoryFfi;
|
||||
}
|
||||
if (Platform.isWindows) {
|
||||
pathOverride ??= "${(await getAppDir()).path}/cake.db";
|
||||
}
|
||||
db = await openDatabase(
|
||||
pathOverride ?? "cake.db",
|
||||
version: 1,
|
||||
@@ -116,4 +120,4 @@ Future<Map<String, dynamic>> _dumpDb() async {
|
||||
ret[tableName] = await db.query(tableName);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user