Allow embedders to specify custom ICU data paths and command line args. (flutter/engine#4290)
This commit is contained in:
@@ -100,13 +100,26 @@ FlutterResult FlutterEngineRun(size_t version,
|
||||
return ptr(user_data);
|
||||
};
|
||||
|
||||
std::string icu_data_path;
|
||||
if (SAFE_ACCESS(args, icu_data_path, nullptr) != nullptr) {
|
||||
icu_data_path = SAFE_ACCESS(args, icu_data_path, nullptr);
|
||||
}
|
||||
|
||||
fxl::CommandLine command_line;
|
||||
if (SAFE_ACCESS(args, command_line_argc, 0) != 0 &&
|
||||
SAFE_ACCESS(args, command_line_argv, nullptr) != nullptr) {
|
||||
command_line = fxl::CommandLineFromArgcArgv(
|
||||
SAFE_ACCESS(args, command_line_argc, 0),
|
||||
SAFE_ACCESS(args, command_line_argv, nullptr));
|
||||
}
|
||||
|
||||
static std::once_flag once_shell_initialization;
|
||||
std::call_once(once_shell_initialization, [&]() {
|
||||
fxl::CommandLine null_command_line;
|
||||
shell::Shell::InitStandalone(
|
||||
fxl::CommandLine{},
|
||||
"", // icu data path default lookup.
|
||||
"" // application library not supported in JIT mode.
|
||||
std::move(command_line),
|
||||
icu_data_path, // icu data path default lookup.
|
||||
"" // application library not supported in JIT mode.
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -65,6 +65,19 @@ typedef struct {
|
||||
// after the call to |FlutterEngineRun| returns. The string must be NULL
|
||||
// terminated.
|
||||
const char* packages_path;
|
||||
// The path to the icudtl.dat file for the project. The string can be
|
||||
// collected after the call to |FlutterEngineRun| returns. The string must
|
||||
// be NULL terminated.
|
||||
const char* icu_data_path;
|
||||
// The command line argument count used to initialize the project. The string
|
||||
// can be collected after the call to |FlutterEngineRun| returns. The string
|
||||
// must be NULL terminated.
|
||||
int command_line_argc;
|
||||
// The command line arguments used to initialize the project. The strings can
|
||||
// be collected after the call to |FlutterEngineRun| returns. The strings must
|
||||
// be NULL terminated.
|
||||
const char* const* command_line_argv;
|
||||
|
||||
} FlutterProjectArgs;
|
||||
|
||||
typedef struct {
|
||||
|
||||
Reference in New Issue
Block a user