From 3ba72da74f7c768bbd20aacfe79873bf9702a26d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Mon, 16 Mar 2015 16:22:16 -0700 Subject: [PATCH] Look inside MapboxGL.bundle when present Fixes #1011. --- platform/darwin/asset_root.mm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/platform/darwin/asset_root.mm b/platform/darwin/asset_root.mm index 375975a84..4dc6b58dc 100644 --- a/platform/darwin/asset_root.mm +++ b/platform/darwin/asset_root.mm @@ -2,13 +2,22 @@ #include +@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 mainBundle] resourceURL] path]; + NSString *path = [[NSBundle bundleForClass:[MGLApplicationRootBundleCanary class]] pathForResource:@"MapboxGL" ofType:@"bundle"]; + if (!path) { + path = [[[NSBundle mainBundle] resourceURL] path]; + } return {[path cStringUsingEncoding : NSUTF8StringEncoding], [path lengthOfBytesUsingEncoding:NSUTF8StringEncoding]}; }();