blob: f47f5d36d11572fcc87c64f139dccc9ed8ddd002 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#import <Foundation/Foundation.h>
#include <mbgl/platform/platform.hpp>
@interface MGLApplicationRootBundleCanary : NSObject
@end
@implementation MGLApplicationRootBundleCanary
@end
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 bundleForClass:[MGLApplicationRootBundleCanary class]] pathForResource:@"Mapbox" ofType:@"bundle"];
if (!path) {
path = [[[NSBundle mainBundle] resourceURL] path];
}
return {[path cStringUsingEncoding : NSUTF8StringEncoding],
[path lengthOfBytesUsingEncoding:NSUTF8StringEncoding]};
}();
return root;
}
}
}
|