summaryrefslogtreecommitdiff
path: root/platform/darwin/src/application_root.mm
blob: d4702c7ec5d4de3d7eafbb7f754439946ba0692a (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 root folder of the application.
const 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;
}
}
}