blob: 4dc6b58dc22f1716733f0197910e4fca133fa9ee (
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:@"MapboxGL" ofType:@"bundle"];
if (!path) {
path = [[[NSBundle mainBundle] resourceURL] path];
}
return {[path cStringUsingEncoding : NSUTF8StringEncoding],
[path lengthOfBytesUsingEncoding:NSUTF8StringEncoding]};
}();
return root;
}
}
}
|