summaryrefslogtreecommitdiff
path: root/platform/darwin/application_root.mm
blob: 19b872c54d49d2d3f38f015a42659327f5ae98e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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;
}
}
}