diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-03-21 18:36:43 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2019-03-22 14:00:11 +0200 |
commit | ed9e605b1e3d136399c67768ab7dfdeafdd62ba5 (patch) | |
tree | b7afdc9dce81f4c4f55e639711553deaeb16b8f0 /platform/glfw/main.cpp | |
parent | db56d8f03e9ec368f20805255da633e770895604 (diff) | |
download | qtlocation-mapboxgl-upstream/options-unique_ptr.tar.gz |
[core] Replace shared_ptr with unique_ptr in {Map,Resource}Optionsupstream/options-unique_ptr
Diffstat (limited to 'platform/glfw/main.cpp')
-rw-r--r-- | platform/glfw/main.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
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); |