mac: Initialize ICU in Node mode

This commit is contained in:
Cheng Zhao 2015-01-16 15:54:38 -08:00
parent ab9e1dd650
commit 51c03c3a71
4 changed files with 22 additions and 2 deletions

View file

@ -340,8 +340,8 @@
'chromium_src/chrome/browser/ui/views/color_chooser_win.cc',
],
'framework_sources': [
'atom/app/atom_library_main.cc',
'atom/app/atom_library_main.h',
'atom/app/atom_library_main.mm',
],
'locales': [
'am', 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en-GB',
@ -801,6 +801,9 @@
'vendor',
'<(libchromiumcontent_include_dir)',
],
'defines': [
'PRODUCT_NAME="<(product_name)"',
],
'export_dependent_settings': [
'<(project_name)_lib',
],

View file

@ -11,6 +11,9 @@
extern "C" {
__attribute__((visibility("default")))
int AtomMain(int argc, const char* argv[]);
__attribute__((visibility("default")))
void AtomInitializeICU();
}
#endif // OS_MACOSX

View file

@ -5,6 +5,9 @@
#include "atom/app/atom_library_main.h"
#include "atom/app/atom_main_delegate.h"
#include "base/i18n/icu_util.h"
#include "base/mac/bundle_locations.h"
#include "brightray/common/mac/main_application_bundle.h"
#include "content/public/app/content_main.h"
#if defined(OS_MACOSX)
@ -15,4 +18,13 @@ int AtomMain(int argc, const char* argv[]) {
params.argv = argv;
return content::ContentMain(params);
}
void AtomInitializeICU() {
base::mac::SetOverrideFrameworkBundlePath(
brightray::MainApplicationBundlePath()
.Append("Contents")
.Append("Frameworks")
.Append(PRODUCT_NAME " Framework.framework"));
base::i18n::InitializeICU();
}
#endif // OS_MACOSX

View file

@ -127,8 +127,10 @@ int main(int argc, const char* argv[]) {
int main(int argc, const char* argv[]) {
char* node_indicator = getenv("ATOM_SHELL_INTERNAL_RUN_AS_NODE");
if (node_indicator != NULL && strcmp(node_indicator, "1") == 0)
if (node_indicator != NULL && strcmp(node_indicator, "1") == 0) {
AtomInitializeICU();
return node::Start(argc, const_cast<char**>(argv));
}
return AtomMain(argc, argv);
}