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(
40 if (assets_path_.is_relative() || icu_path_.is_relative() ||
41 (!aot_library_path_.empty() && aot_library_path_.is_relative())) {
43 if (executable_location.empty()) {
45 <<
"Unable to find executable location to resolve resource paths.";
46 assets_path_ = std::filesystem::path();
47 icu_path_ = std::filesystem::path();
49 assets_path_ = std::filesystem::path(executable_location) / assets_path_;
50 icu_path_ = std::filesystem::path(executable_location) / icu_path_;
51 if (!aot_library_path_.empty()) {
53 std::filesystem::path(executable_location) / aot_library_path_;
60 return !assets_path_.empty() && !icu_path_.empty();
66 const FlutterEngineProcTable& engine_procs) {
67 if (aot_library_path_.empty()) {
69 <<
"Attempted to load AOT data, but no aot_library_path was provided.";
72 if (!std::filesystem::exists(aot_library_path_)) {
73 FML_LOG(ERROR) <<
"Can't load AOT data from " << aot_library_path_
77 std::string path_string = fml::PathToUtf8(aot_library_path_);
78 FlutterEngineAOTDataSource source = {};
79 source.type = kFlutterEngineAOTDataSourceTypeElfPath;
80 source.elf_path = path_string.c_str();
81 FlutterEngineAOTData data =
nullptr;
82 auto result = engine_procs.CreateAOTData(&source, &data);
83 if (result != kSuccess) {
84 FML_LOG(ERROR) <<
"Failed to load AOT data from: " << path_string;
93 const std::vector<std::string>& switches) {
94 engine_switches_ = switches;
98 if (engine_switches_.size() == 0) {
101 std::vector<std::string> switches;
102 switches.insert(switches.end(), engine_switches_.begin(),
103 engine_switches_.end());
106 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
const char ** dart_entrypoint_argv
FlutterDesktopUIThreadPolicy ui_thread_policy
const wchar_t * aot_library_path
FlutterDesktopGpuPreference gpu_preference