|
10 | 10 | #include <vector> |
11 | 11 |
|
12 | 12 | #include "flutter/common/constants.h" |
| 13 | +#include "flutter/fml/paths.h" |
13 | 14 | #include "flutter/shell/platform/common/app_lifecycle_state.h" |
14 | 15 | #include "flutter/shell/platform/common/engine_switches.h" |
15 | 16 | #include "flutter/shell/platform/embedder/embedder.h" |
@@ -673,6 +674,28 @@ - (BOOL)runWithEntrypoint:(NSString*)entrypoint { |
673 | 674 | [engine onVSync:baton]; |
674 | 675 | }; |
675 | 676 |
|
| 677 | + NSString* bundlePath = |
| 678 | + [[NSBundle bundleWithURL:[NSBundle.mainBundle.privateFrameworksURL |
| 679 | + URLByAppendingPathComponent:@"App.framework"]] bundlePath]; |
| 680 | + bundlePath = [bundlePath stringByAppendingString:@"/App"]; |
| 681 | + flutterArguments.shorebird_args.app_path = bundlePath.UTF8String; |
| 682 | + NSString* assetsPath = _project.assetsPath; |
| 683 | + NSURL* shorebirdYamlPath = [NSURL URLWithString:@"shorebird.yaml" |
| 684 | + relativeToURL:[NSURL fileURLWithPath:assetsPath]]; |
| 685 | + NSString* shorebirdYamlContents = [NSString stringWithContentsOfURL:shorebirdYamlPath |
| 686 | + encoding:NSUTF8StringEncoding |
| 687 | + error:nil]; |
| 688 | + NSString* appVersion = |
| 689 | + [NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; |
| 690 | + NSString* appBuildNumber = [NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"]; |
| 691 | + flutterArguments.shorebird_args.app_version = appVersion.UTF8String; |
| 692 | + flutterArguments.shorebird_args.app_build_number = appBuildNumber.UTF8String; |
| 693 | + |
| 694 | + std::string cache_path = |
| 695 | + fml::paths::JoinPaths({getenv("HOME"), "Library", "Application Support", "shorebird"}); |
| 696 | + flutterArguments.shorebird_args.cache_path = cache_path.c_str(); |
| 697 | + flutterArguments.shorebird_args.shorebird_yaml_contents = shorebirdYamlContents.UTF8String; |
| 698 | + |
676 | 699 | FlutterRendererConfig rendererConfig = [_renderer createRendererConfig]; |
677 | 700 | FlutterEngineResult result = _embedderAPI.Initialize( |
678 | 701 | FLUTTER_ENGINE_VERSION, &rendererConfig, &flutterArguments, (__bridge void*)(self), &_engine); |
|
0 commit comments