summaryrefslogtreecommitdiff
path: root/common/ios.mm
diff options
context:
space:
mode:
Diffstat (limited to 'common/ios.mm')
-rw-r--r--common/ios.mm21
1 files changed, 21 insertions, 0 deletions
diff --git a/common/ios.mm b/common/ios.mm
new file mode 100644
index 0000000000..7989e73a4e
--- /dev/null
+++ b/common/ios.mm
@@ -0,0 +1,21 @@
+#import <Foundation/Foundation.h>
+
+#include <mbgl/platform/platform.hpp>
+
+namespace mbgl {
+namespace platform {
+
+// Returns the path to the default cache database on this system.
+std::string defaultCacheDatabase() {
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
+ if ([paths count] == 0) {
+ // Disable the cache if we don't have a location to write.
+ return "";
+ }
+
+ NSString *libraryDirectory = [paths objectAtIndex:0];
+ return [[libraryDirectory stringByAppendingPathComponent:@"cache.db"] UTF8String];
+}
+
+}
+}