Skip to content

Commit

Permalink
Allow embedders to specify custom ICU data paths and command line arg…
Browse files Browse the repository at this point in the history
…s. (flutter#4290)
  • Loading branch information
chinmaygarde authored Oct 28, 2017
1 parent 93da8c8 commit ede57ad
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
19 changes: 16 additions & 3 deletions shell/platform/embedder/embedder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
);
});

Expand Down
13 changes: 13 additions & 0 deletions shell/platform/embedder/embedder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ede57ad

Please sign in to comment.