From 87b1da761156ec339ab4ccd159e6ba6997f9e7d0 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Wed, 20 May 2015 08:21:29 -0700 Subject: DefaultFileSource has responsibility for handling mapbox:// URLs --- linux/main.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'linux') 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(); -- cgit v1.2.1