summaryrefslogtreecommitdiff
path: root/macosx
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-07-10 11:27:03 -0700
committerKonstantin Käfer <mail@kkaefer.com>2014-07-10 11:27:03 -0700
commit0d7b3462e9e72190d41341e7da243d6f0732e4ef (patch)
treeeabad69a956a410b2951977281259dd631a32acb /macosx
parent795496053b828b9f536124066e70f492780939d1 (diff)
downloadqtlocation-mapboxgl-0d7b3462e9e72190d41341e7da243d6f0732e4ef.tar.gz
read access token from environment
Diffstat (limited to 'macosx')
-rw-r--r--macosx/main.mm10
1 files changed, 8 insertions, 2 deletions
diff --git a/macosx/main.mm b/macosx/main.mm
index d04da2b430..3b01df04e6 100644
--- a/macosx/main.mm
+++ b/macosx/main.mm
@@ -1,6 +1,5 @@
#include "../common/settings_nsuserdefaults.hpp"
#include "../common/glfw_view.hpp"
-#include "../access_token.hpp"
#import <Foundation/Foundation.h>
@@ -14,8 +13,15 @@ int main() {
map.setAngle(settings.angle);
map.setDebug(settings.debug);
+ // Set access token if present
+ const char *token = getenv("MAPBOX_ACCESS_TOKEN");
+ if (token == nullptr) {
+ fprintf(stderr, "[WARNING] no access token set. mapbox.com tiles won't work.\n");
+ } else {
+ map.setAccessToken(std::string(token));
+ }
+
// Load style
- map.setAccessToken(mapbox_access_token);
NSString *path = [[NSBundle mainBundle] pathForResource:@"style.min" ofType:@"js"];
NSString *json = [NSString stringWithContentsOfFile:path
encoding:[NSString defaultCStringEncoding]