diff options
Diffstat (limited to 'linux/main.cpp')
-rw-r--r-- | linux/main.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/linux/main.cpp b/linux/main.cpp index d279e9d8fe..558f95dbed 100644 --- a/linux/main.cpp +++ b/linux/main.cpp @@ -70,6 +70,15 @@ int main(int argc, char *argv[]) { mbgl::SQLiteCache cache("/tmp/mbgl-cache.db"); mbgl::DefaultFileSource fileSource(&cache); + + // Set access token if present + const char *token = getenv("MAPBOX_ACCESS_TOKEN"); + if (token == nullptr) { + mbgl::Log::Warning(mbgl::Event::Setup, "no access token set. mapbox.com tiles won't work."); + } else { + fileSource.setAccessToken(std::string(token)); + } + mbgl::Map map(*view, fileSource); // Load settings @@ -92,14 +101,6 @@ int main(int argc, char *argv[]) { mbgl::Log::Info(mbgl::Event::Setup, std::string("Changed style to: ") + newStyle.first); }); - // Set access token if present - const char *token = getenv("MAPBOX_ACCESS_TOKEN"); - if (token == nullptr) { - mbgl::Log::Warning(mbgl::Event::Setup, "no access token set. mapbox.com tiles won't work."); - } else { - map.setAccessToken(std::string(token)); - } - // Load style if (style.empty()) { const auto& newStyle = mbgl::util::defaultStyles.front(); |