Also apply temp directory workaround on iOS

This commit is contained in:
Simon Binder 2023-10-25 22:19:04 +02:00
parent ca4e376c8b
commit a4938abb19
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
1 changed files with 7 additions and 6 deletions

View File

@ -53,14 +53,15 @@ LazyDatabase _openConnection() {
// Also work around limitations on old Android versions
if (Platform.isAndroid) {
await applyWorkaroundToOpenSqlite3OnOldAndroidVersions();
final cachebase = (await getTemporaryDirectory()).path;
// We can't access /tmp on Android, which sqlite3 would try by default.
// Explicitly tell it about the correct temporary directory.
sqlite3.tempDirectory = cachebase;
}
// Make sqlite3 pick a more suitable location for temporary files - the
// one from the system may be inaccessible due to sandboxing.
final cachebase = (await getTemporaryDirectory()).path;
// We can't access /tmp on Android, which sqlite3 would try by default.
// Explicitly tell it about the correct temporary directory.
sqlite3.tempDirectory = cachebase;
return NativeDatabase.createInBackground(file);
});
}