summaryrefslogtreecommitdiff
path: root/platform/darwin/asset_root.mm
blob: 375975a84bb5a01cc3a739521effb4f10105c4f5 (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 &assetRoot() {
    static const std::string root = []() -> std::string {
        NSString *path = [[[NSBundle mainBundle] resourceURL] path];
        return {[path cStringUsingEncoding : NSUTF8StringEncoding],
                [path lengthOfBytesUsingEncoding:NSUTF8StringEncoding]};
    }();
    return root;
}
}
}