Allow embedders to specify custom ICU data paths and command line args. (flutter/engine#4290)

This commit is contained in:
Chinmay Garde
2017-10-27 17:31:13 -07:00
committed by GitHub
parent 126dd15633
commit a9721eb9d8
2 changed files with 29 additions and 3 deletions

View File

@@ -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.
);
});

View File

@@ -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 {