7 #include <Foundation/Foundation.h>
18 NSDirectoryEnumerator<NSURL*>* frameworkEnumerator = [NSFileManager.defaultManager
19 enumeratorAtURL:searchURL
20 includingPropertiesForKeys:nil
21 options:NSDirectoryEnumerationSkipsSubdirectoryDescendants |
22 NSDirectoryEnumerationSkipsHiddenFiles
26 for (NSURL* candidate in frameworkEnumerator) {
27 NSBundle* flutterFrameworkBundle = [NSBundle bundleWithURL:candidate];
28 if ([flutterFrameworkBundle.bundleIdentifier isEqualToString:flutterFrameworkBundleID]) {
29 return flutterFrameworkBundle;
36 NSBundle* mainBundle = NSBundle.mainBundle;
38 if ([mainBundle.bundleURL.pathExtension isEqualToString:
@"appex"]) {
40 return [NSBundle bundleWithURL:mainBundle.bundleURL.URLByDeletingLastPathComponent
41 .URLByDeletingLastPathComponent];
48 NSBundle* flutterFrameworkBundle =
50 if (flutterFrameworkBundle == nil) {
52 flutterFrameworkBundle = [NSBundle bundleWithIdentifier:flutterFrameworkBundleID];
54 if (flutterFrameworkBundle == nil) {
55 flutterFrameworkBundle = NSBundle.mainBundle;
57 return flutterFrameworkBundle;
67 if (flutterAssetsPath.length == 0) {
70 return flutterAssetsPath;
76 NSString* assetsPath = [bundle pathForResource:relativeAssetsPath ofType:nil];
77 if (assetsPath.length == 0) {
81 assetsPath = [bundle pathForResource:
@"flutter_assets" ofType:nil];