Skip to content

Commit

Permalink
Make flx filename configurable in Info.plist for iOS (flutter#3274)
Browse files Browse the repository at this point in the history
  • Loading branch information
tvolkert authored Nov 28, 2016
1 parent f6547c1 commit e25f2a5
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,16 @@ - (instancetype)initFromDefaultSourceForConfiguration {
if (flxURL == nil) {
// If the URL was not specified on the command line, look inside the
// FlutterApplication bundle.
flxURL =
[NSURL fileURLWithPath:[bundle pathForResource:@"app" ofType:@"flx"]
isDirectory:NO];
NSString* flxPath = [self pathForFLXFromBundle:bundle];
if (flxPath != nil) {
flxURL = [NSURL fileURLWithPath:flxPath isDirectory:NO];
}
}

if (flxURL == nil) {
NSLog(@"Error: FLX file not present in bundle; unable to start app.");
[self release];
return nil;
}

NSURL* dartMainURL =
Expand Down Expand Up @@ -131,6 +138,16 @@ - (void)checkReadiness {
}
}

- (NSString*)pathForFLXFromBundle:(NSBundle*)bundle {
NSString* flxName = [bundle objectForInfoDictionaryKey:@"FLTFlxName"];
if (flxName == nil) {
// Default to "app.flx"
flxName = @"app";
}

return [bundle pathForResource:flxName ofType:@"flx"];
}

#pragma mark - Launching the project in a preconfigured engine.

static NSString* NSStringFromVMType(VMType type) {
Expand Down Expand Up @@ -198,9 +215,7 @@ - (void)runFromPrecompiledSourceInEngine:(shell::Engine*)engine
return;
}

NSString* path =
[_precompiledDartBundle pathForResource:@"app" ofType:@"flx"];

NSString* path = [self pathForFLXFromBundle:_precompiledDartBundle];
if (path.length == 0) {
NSString* message =
[NSString stringWithFormat:@"Could not find the 'app.flx' archive in "
Expand Down

0 comments on commit e25f2a5

Please sign in to comment.