summaryrefslogtreecommitdiff
path: root/platform/ios/demo/Examples/insert-mapbox-token.sh
diff options
context:
space:
mode:
Diffstat (limited to 'platform/ios/demo/Examples/insert-mapbox-token.sh')
-rwxr-xr-xplatform/ios/demo/Examples/insert-mapbox-token.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/platform/ios/demo/Examples/insert-mapbox-token.sh b/platform/ios/demo/Examples/insert-mapbox-token.sh
new file mode 100755
index 0000000000..a65f686b1a
--- /dev/null
+++ b/platform/ios/demo/Examples/insert-mapbox-token.sh
@@ -0,0 +1,14 @@
+token_file=$SRCROOT/mapbox_access_token
+
+# First check the above path, then the user directory.
+# Ignore exit codes from `cat`.
+token="$(cat $token_file 2> /dev/null)" || token="$(cat ~/.mapbox 2> /dev/null)"
+
+if [ "$token" ]; then
+ plutil -replace MGLMapboxAccessToken -string $token "$TARGET_BUILD_DIR/$INFOPLIST_PATH"
+else
+ echo 'error: Missing Mapbox access token'
+ open 'https://www.mapbox.com/studio/account/tokens/'
+ echo "error: Get an access token from <https://www.mapbox.com/studio/account/tokens/>, then create a new file at $token_file that contains the access token."
+ exit 1
+fi