diff --git a/platform/android/src/file_source.cpp b/platform/android/src/file_source.cpp index d9b8e12dc40..9b639d2610a 100644 --- a/platform/android/src/file_source.cpp +++ b/platform/android/src/file_source.cpp @@ -6,6 +6,8 @@ #include #include +#include + #include "asset_manager_file_source.hpp" namespace mbgl { @@ -17,6 +19,8 @@ FileSource::FileSource(jni::JNIEnv& _env, const jni::String& accessToken, const jni::String& _cachePath, const jni::Object& assetManager) { + mapbox::sqlite::setTempPath(jni::Make(_env, _cachePath)); + // Create a core default file source fileSource = std::make_unique( jni::Make(_env, _cachePath) + "/mbgl-offline.db", diff --git a/platform/default/sqlite3.cpp b/platform/default/sqlite3.cpp index f7c6efc10d6..f8a7daefe60 100644 --- a/platform/default/sqlite3.cpp +++ b/platform/default/sqlite3.cpp @@ -40,6 +40,10 @@ static_assert(mbgl::underlying_type(ResultCode::Auth) == SQLITE_AUTH, "error"); static_assert(mbgl::underlying_type(ResultCode::Range) == SQLITE_RANGE, "error"); static_assert(mbgl::underlying_type(ResultCode::NotADB) == SQLITE_NOTADB, "error"); +void setTempPath(const std::string& path) { + sqlite3_temp_directory = sqlite3_mprintf("%s", path.c_str()); +} + class DatabaseImpl { public: DatabaseImpl(sqlite3* db_) diff --git a/platform/default/sqlite3.hpp b/platform/default/sqlite3.hpp index 16f76a0d1a5..33f735d9045 100644 --- a/platform/default/sqlite3.hpp +++ b/platform/default/sqlite3.hpp @@ -67,6 +67,8 @@ class StatementImpl; class Query; class Transaction; +void setTempPath(const std::string&); + class Database { private: Database(std::unique_ptr);