summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/src/file_source.cpp4
-rw-r--r--platform/glfw/main.cpp8
-rw-r--r--platform/node/src/node_map.cpp11
3 files changed, 10 insertions, 13 deletions
diff --git a/platform/android/src/file_source.cpp b/platform/android/src/file_source.cpp
index bb1f30981b..94db563efc 100644
--- a/platform/android/src/file_source.cpp
+++ b/platform/android/src/file_source.cpp
@@ -31,7 +31,7 @@ FileSource::FileSource(jni::JNIEnv& _env,
std::string path = jni::Make<std::string>(_env, _cachePath);
mapbox::sqlite::setTempPath(path);
- resourceOptions = mbgl::ResourceOptions()
+ resourceOptions
.withAccessToken(accessToken ? jni::Make<std::string>(_env, accessToken) : "")
.withCachePath(path + DATABASE_FILE)
.withPlatformContext(reinterpret_cast<void*>(new AssetManagerFileSource(_env, assetManager)));
@@ -120,7 +120,7 @@ FileSource* FileSource::getNativePeer(jni::JNIEnv& env, const jni::Object<FileSo
mbgl::ResourceOptions FileSource::getSharedResourceOptions(jni::JNIEnv& env, const jni::Object<FileSource>& jFileSource) {
FileSource* fileSource = FileSource::getNativePeer(env, jFileSource);
assert(fileSource != nullptr);
- return fileSource->resourceOptions;
+ return mbgl::ResourceOptions(fileSource->resourceOptions);
}
void FileSource::registerNative(jni::JNIEnv& env) {
diff --git a/platform/glfw/main.cpp b/platform/glfw/main.cpp
index 8288a009f2..77585718e1 100644
--- a/platform/glfw/main.cpp
+++ b/platform/glfw/main.cpp
@@ -94,12 +94,14 @@ int main(int argc, char *argv[]) {
view = &backend;
// Set access token if present
- const char *token = getenv("MAPBOX_ACCESS_TOKEN");
- if (token == nullptr) {
+ std::string token(getenv("MAPBOX_ACCESS_TOKEN") ?: "");
+ if (token.empty()) {
mbgl::Log::Warning(mbgl::Event::Setup, "no access token set. mapbox.com tiles won't work.");
}
- auto resourceOptions = mbgl::ResourceOptions().withCachePath(cacheDB).withAssetPath(".").withAccessToken(std::string(token));
+ mbgl::ResourceOptions resourceOptions;
+ resourceOptions.withCachePath(cacheDB).withAccessToken(token);
+
auto fileSource = std::static_pointer_cast<mbgl::DefaultFileSource>(mbgl::FileSource::getSharedFileSource(resourceOptions));
if (!settings.online) {
fileSource->setOnlineStatus(false);
diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp
index 0b27d378a7..7ad9c362bf 100644
--- a/platform/node/src/node_map.cpp
+++ b/platform/node/src/node_map.cpp
@@ -631,14 +631,9 @@ void NodeMap::cancel() {
});
frontend = std::make_unique<mbgl::HeadlessFrontend>(mbgl::Size{ 256, 256 }, pixelRatio, threadpool);
- auto mapOptions = mbgl::MapOptions()
- .withMapMode(mode)
- .withCrossSourceCollisions(crossSourceCollisions);
-
- auto resourceOptions = mbgl::ResourceOptions().withPlatformContext(reinterpret_cast<void*>(this));
-
- map = std::make_unique<mbgl::Map>(*frontend, mapObserver, frontend->getSize(), pixelRatio,
- threadpool, mapOptions, resourceOptions);
+ map = std::make_unique<mbgl::Map>(*frontend, mapObserver, frontend->getSize(), pixelRatio, threadpool,
+ mbgl::MapOptions().withMapMode(mode).withCrossSourceCollisions(crossSourceCollisions),
+ mbgl::ResourceOptions().withPlatformContext(reinterpret_cast<void*>(this)));
// FIXME: Reload the style after recreating the map. We need to find
// a better way of canceling an ongoing rendering on the core level