提交 e25f2a51 编写于 作者: T Todd Volkert 提交者: GitHub

Make flx filename configurable in Info.plist for iOS (#3274)

上级 f6547c1d
......@@ -97,9 +97,16 @@ static NSURL* URLForSwitch(const char* name) {
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 =
......@@ -131,6 +138,16 @@ static NSURL* URLForSwitch(const char* name) {
}
}
- (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) {
......@@ -198,9 +215,7 @@ static NSString* NSStringFromVMType(VMType type) {
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 "
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册