| Index: services/service_manager/public/cpp/standalone_service/main.cc
|
| diff --git a/services/service_manager/public/cpp/standalone_service/main.cc b/services/service_manager/public/cpp/standalone_service/main.cc
|
| index 717fe48188cf787dfd5a57d4ff6cb985613791c5..f63309bc9fdfcb545a56ef36e55eed2fe6c118bf 100644
|
| --- a/services/service_manager/public/cpp/standalone_service/main.cc
|
| +++ b/services/service_manager/public/cpp/standalone_service/main.cc
|
| @@ -3,11 +3,13 @@
|
| // found in the LICENSE file.
|
|
|
| #include "base/at_exit.h"
|
| +#include "base/base_paths.h"
|
| #include "base/command_line.h"
|
| #include "base/debug/stack_trace.h"
|
| #include "base/i18n/icu_util.h"
|
| #include "base/logging.h"
|
| #include "base/macros.h"
|
| +#include "base/path_service.h"
|
| #include "base/process/launch.h"
|
| #include "services/service_manager/public/c/main.h"
|
| #include "services/service_manager/public/cpp/standalone_service/standalone_service.h"
|
| @@ -20,6 +22,42 @@
|
| #endif
|
|
|
| namespace {
|
| +
|
| +// Cross-platform helper to override the necessary hard-coded path location
|
| +// used to load ICU data.
|
| +//
|
| +// TODO(rockot): We should just parameterize InitializeICU so hacks like
|
| +// this are unnecessary.
|
| +class ScopedIcuDataDirOverride {
|
| + public:
|
| + ScopedIcuDataDirOverride(const base::FilePath& path) {
|
| +#if defined(OS_WIN)
|
| + base::PathService::Get(base::DIR_MODULE, &original_path_);
|
| +#elif defined(OS_MACOSX)
|
| + original_path_= base::mac::FrameworkBundlePath();
|
| +#else
|
| + base::PathService::Get(base::DIR_EXE, &original_path_);
|
| +#endif
|
| +
|
| + if (!path.empty())
|
| + SetPathOverride(path);
|
| + }
|
| +
|
| + ~ScopedIcuDataDirOverride() { SetPathOverride(original_path_); }
|
| +
|
| + private:
|
| + static void SetPathOverride(const base::FilePath& path) {
|
| +#if defined(OS_WIN)
|
| + base::PathService::Override(base::DIR_MODULE, path);
|
| +#elif defined(OS_MACOSX)
|
| + base::mac::SetOverrideFrameworkBundlePath(path);
|
| +#else
|
| + base::PathService::Override(base::DIR_EXE, path);
|
| +#endif
|
| + }
|
| +
|
| + base::FilePath original_path_;
|
| +};
|
|
|
| // TODO(rockot): We should consider removing ServiceMain and instead allowing
|
| // service sources to define a CreateService method which returns a new instance
|
| @@ -43,7 +81,12 @@
|
|
|
| service_manager::InitializeLogging();
|
|
|
| - base::i18n::InitializeICU();
|
| + {
|
| + base::FilePath icu_data_dir = base::CommandLine::ForCurrentProcess()
|
| + ->GetSwitchValuePath(service_manager::switches::kIcuDataDir);
|
| + ScopedIcuDataDirOverride path_override(icu_data_dir);
|
| + base::i18n::InitializeICU();
|
| + }
|
|
|
| #if !defined(OFFICIAL_BUILD)
|
| // Initialize stack dumping before initializing sandbox to make sure symbol
|
|
|