|
8 | 8 |
|
9 | 9 | FLUTTER_ASSERT_ARC
|
10 | 10 |
|
11 |
| -const NSString* kDefaultAssetPath = @"Frameworks/App.framework/flutter_assets"; |
12 |
| -static NSString* GetFlutterAssetPathFromBundle(NSBundle* bundle); |
| 11 | +NSString* kDefaultAssetPath = @"Frameworks/App.framework/flutter_assets"; |
| 12 | +static NSString* GetFlutterAssetsPathFromBundle(NSBundle* bundle, NSString* relativeAssetsPath); |
13 | 13 |
|
14 | 14 | NSBundle* FLTFrameworkBundleInternal(NSString* flutterFrameworkBundleID, NSURL* searchURL) {
|
15 | 15 | NSDirectoryEnumerator<NSURL*>* frameworkEnumerator = [NSFileManager.defaultManager
|
|
55 | 55 | }
|
56 | 56 |
|
57 | 57 | NSString* FLTAssetPath(NSBundle* bundle) {
|
58 |
| - return [bundle objectForInfoDictionaryKey:@"FLTAssetsPath"] ?: kDefaultAssetPath; |
| 58 | + return [bundle objectForInfoDictionaryKey:@"FLTAssetsPath"] ?: relativeAssetsPath; |
59 | 59 | }
|
60 | 60 |
|
61 | 61 | NSString* FLTAssetsPathFromBundle(NSBundle* bundle) {
|
62 |
| - NSString* flutterAssetsPath = GetFlutterAssetPathFromBundle(bundle); |
| 62 | + NSString* relativeAssetsPath = FLTAssetPath(bundle); |
| 63 | + NSString* flutterAssetsPath = GetFlutterAssetsPathFromBundle(bundle, relativeAssetsPath); |
63 | 64 | if (flutterAssetsPath.length == 0) {
|
64 |
| - flutterAssetsPath = GetFlutterAssetPathFromBundle(NSBundle.mainBundle); |
| 65 | + flutterAssetsPath = GetFlutterAssetsPathFromBundle(NSBundle.mainBundle, relativeAssetsPath); |
65 | 66 | }
|
66 | 67 | return flutterAssetsPath;
|
67 | 68 | }
|
68 | 69 |
|
69 |
| -static NSString* GetFlutterAssetPathFromBundle(NSBundle* bundle) { |
70 |
| - NSString* flutterAssetsPath = FLTAssetPath(bundle); |
| 70 | +static NSString* GetFlutterAssetsPathFromBundle(NSBundle* bundle, NSString* relativeAssetsPath) { |
71 | 71 | // Use the raw path solution so that asset path can be returned from unloaded bundles.
|
72 | 72 | // See https://github.com/flutter/engine/pull/46073
|
73 |
| - NSString* assetsPath = [bundle pathForResource:flutterAssetsPath ofType:nil]; |
| 73 | + NSString* assetsPath = [bundle pathForResource:relativeAssetsPath ofType:nil]; |
74 | 74 | if (assetsPath.length == 0) {
|
75 | 75 | // In app extension, using full relative path (kDefaultAssetPath)
|
76 | 76 | // returns nil when the app bundle is not loaded. Try to use
|
|
0 commit comments