summaryrefslogtreecommitdiff
path: root/platform/darwin
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-12-17 14:59:05 +0100
committerKonstantin Käfer <mail@kkaefer.com>2014-12-17 14:59:05 +0100
commitb5e9998b15d8a51bdca9cdb2d0981f69629f532a (patch)
tree365a26903cd4df16fbcfe3d6f9553d1ce62b2c1a /platform/darwin
parent936e09651424f111ac2ac64e2e60e2d13b082ebf (diff)
downloadqtlocation-mapboxgl-b5e9998b15d8a51bdca9cdb2d0981f69629f532a.tar.gz
change file:// to asset:// to indicate that they aren't arbitrary files
refs #579
Diffstat (limited to 'platform/darwin')
-rw-r--r--platform/darwin/application_root.mm18
1 files changed, 18 insertions, 0 deletions
diff --git a/platform/darwin/application_root.mm b/platform/darwin/application_root.mm
new file mode 100644
index 0000000000..19b872c54d
--- /dev/null
+++ b/platform/darwin/application_root.mm
@@ -0,0 +1,18 @@
+#import <Foundation/Foundation.h>
+
+#include <mbgl/platform/platform.hpp>
+
+namespace mbgl {
+namespace platform {
+
+// Returns the path to the default shader cache on this system.
+std::string applicationRoot() {
+ static const std::string root = []() -> std::string {
+ NSString *path = [[[NSBundle mainBundle] resourceURL] path];
+ return {[path cStringUsingEncoding : NSUTF8StringEncoding],
+ [path lengthOfBytesUsingEncoding:NSUTF8StringEncoding]};
+ }();
+ return root;
+}
+}
+}