5 #include <Foundation/Foundation.h>
15 NSDirectoryEnumerator<NSURL*>* frameworkEnumerator = [NSFileManager.defaultManager
16 enumeratorAtURL:searchURL
17 includingPropertiesForKeys:nil
18 options:NSDirectoryEnumerationSkipsSubdirectoryDescendants |
19 NSDirectoryEnumerationSkipsHiddenFiles
23 for (NSURL* candidate in frameworkEnumerator) {
24 NSBundle* flutterFrameworkBundle = [NSBundle bundleWithURL:candidate];
25 if ([flutterFrameworkBundle.bundleIdentifier isEqualToString:flutterFrameworkBundleID]) {
26 return flutterFrameworkBundle;
33 NSBundle* mainBundle = NSBundle.mainBundle;
35 if ([mainBundle.bundleURL.pathExtension isEqualToString:
@"appex"]) {
37 return [NSBundle bundleWithURL:mainBundle.bundleURL.URLByDeletingLastPathComponent
38 .URLByDeletingLastPathComponent];
45 NSBundle* flutterFrameworkBundle =
47 if (flutterFrameworkBundle == nil) {
49 flutterFrameworkBundle = [NSBundle bundleWithIdentifier:flutterFrameworkBundleID];
51 if (flutterFrameworkBundle == nil) {
52 flutterFrameworkBundle = NSBundle.mainBundle;
54 return flutterFrameworkBundle;
64 if (flutterAssetsPath.length == 0) {
67 return flutterAssetsPath;
73 NSString* assetsPath = [bundle pathForResource:relativeAssetsPath ofType:nil];
74 if (assetsPath.length == 0) {
78 assetsPath = [bundle pathForResource:
@"flutter_assets" ofType:nil];