Skip to content

Commit 90f5708

Browse files
committed
..
1 parent 42dfe7d commit 90f5708

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/src/bridge/local_db_bridge.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ class LocalDbBridge extends LocalSbRequestImpl {
6464
final appDir = await getApplicationDocumentsDirectory();
6565

6666
/// Initialize database with default route and database name.
67-
await _init('${appDir.path}/$databaseName');
67+
// Remove .db extension since Rust will add .lmdb
68+
final dbBaseName = databaseName.replaceAll('.db', '');
69+
await _init('${appDir.path}/$dbBaseName');
6870
}
6971

7072
Future<void> initialize(String databaseName) async {
@@ -115,7 +117,9 @@ class LocalDbBridge extends LocalSbRequestImpl {
115117
log('Using app directory: ${appDir.path}');
116118

117119
/// Initialize database with default route and database name.
118-
await _init('${appDir.path}/$databaseName');
120+
// Remove .db extension since Rust will add .lmdb
121+
final dbBaseName = databaseName.replaceAll('.db', '');
122+
await _init('${appDir.path}/$dbBaseName');
119123

120124
// Marcar como inicializado completamente
121125
_isInitialized = true;
@@ -161,7 +165,8 @@ class LocalDbBridge extends LocalSbRequestImpl {
161165

162166
// Reinicializar solo la instancia de base de datos
163167
final appDir = await getApplicationDocumentsDirectory();
164-
await _init('${appDir.path}/$_lastDatabaseName');
168+
final dbBaseName = _lastDatabaseName!.replaceAll('.db', '');
169+
await _init('${appDir.path}/$dbBaseName');
165170
log('Database connection reestablished successfully');
166171
return true;
167172
} catch (e) {

0 commit comments

Comments
 (0)