9 #include "flutter/fml/logging.h"
10 #include "flutter/fml/string_conversion.h"
18 : assets_path_(properties.assets_path),
19 icu_path_(properties.icu_data_path) {
29 dart_entrypoint_arguments_.push_back(
46 if (assets_path_.is_relative() || icu_path_.is_relative() ||
47 (!aot_library_path_.empty() && aot_library_path_.is_relative())) {
49 if (executable_location.empty()) {
51 <<
"Unable to find executable location to resolve resource paths.";
52 assets_path_ = std::filesystem::path();
53 icu_path_ = std::filesystem::path();
55 assets_path_ = std::filesystem::path(executable_location) / assets_path_;
56 icu_path_ = std::filesystem::path(executable_location) / icu_path_;
57 if (!aot_library_path_.empty()) {
59 std::filesystem::path(executable_location) / aot_library_path_;
66 return !assets_path_.empty() && !icu_path_.empty();
72 const FlutterEngineProcTable& engine_procs) {
73 if (aot_library_path_.empty()) {
75 <<
"Attempted to load AOT data, but no aot_library_path was provided.";
78 if (!std::filesystem::exists(aot_library_path_)) {
79 FML_LOG(ERROR) <<
"Can't load AOT data from " << aot_library_path_
83 std::string path_string = fml::PathToUtf8(aot_library_path_);
84 FlutterEngineAOTDataSource source = {};
85 source.type = kFlutterEngineAOTDataSourceTypeElfPath;
86 source.elf_path = path_string.c_str();
87 FlutterEngineAOTData data =
nullptr;
88 auto result = engine_procs.CreateAOTData(&source, &data);
89 if (result != kSuccess) {
90 FML_LOG(ERROR) <<
"Failed to load AOT data from: " << path_string;
99 const std::vector<std::string>& switches) {
100 engine_switches_ = switches;
104 if (engine_switches_.size() == 0) {
107 std::vector<std::string> switches;
108 switches.insert(switches.end(), engine_switches_.begin(),
109 engine_switches_.end());
112 switches.insert(switches.end(), env_switches.begin(), env_switches.end());
const std::vector< std::string > GetSwitches()
FlutterProjectBundle(const FlutterDesktopEngineProperties &properties)
UniqueAotDataPtr LoadAotData(const FlutterEngineProcTable &engine_procs)
void SetSwitches(const std::vector< std::string > &switches)
std::vector< std::string > GetSwitchesFromEnvironment()
std::filesystem::path GetExecutableDirectory()
std::unique_ptr< _FlutterEngineAOTData, FlutterEngineCollectAOTDataFnPtr > UniqueAotDataPtr
const char * dart_entrypoint
FlutterDesktopAccessibilityMode accessibility_mode
FlutterDesktopImpellerSwitch impeller_switch
const char ** dart_entrypoint_argv
FlutterDesktopUIThreadPolicy ui_thread_policy
const wchar_t * aot_library_path
FlutterDesktopGpuPreference gpu_preference