summaryrefslogtreecommitdiff
path: root/common/ios.mm
blob: 7989e73a4e0ac435d7dde0f9d8a977791fd7a0ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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];
}

}
}