Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Unified Diff: src/icu_util.cc

Issue 2042253002: [icu] Support loading data file from default location (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Format Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/icu_util.h ('k') | src/snapshot/mksnapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/icu_util.cc
diff --git a/src/icu_util.cc b/src/icu_util.cc
index 02251306c86e9d4421525bd84780d0f6751d52b3..a6f0453fc23e95145b1965eb3688e6968551f7f4 100644
--- a/src/icu_util.cc
+++ b/src/icu_util.cc
@@ -15,6 +15,8 @@
#include "unicode/putil.h"
#include "unicode/udata.h"
+#include "src/base/file-utils.h"
+
#define ICU_UTIL_DATA_FILE 0
#define ICU_UTIL_DATA_SHARED 1
#define ICU_UTIL_DATA_STATIC 2
@@ -38,6 +40,26 @@ void free_icu_data_ptr() {
} // namespace
#endif
+bool InitializeICUDefaultLocation(const char* exec_path,
+ const char* icu_data_file) {
+#if !defined(V8_I18N_SUPPORT)
+ return true;
+#else
+#if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE
+ if (icu_data_file) {
+ return InitializeICU(icu_data_file);
+ }
+ char* icu_data_file_default;
+ RelativePath(&icu_data_file_default, exec_path, "icudtl.dat");
+ bool result = InitializeICU(icu_data_file_default);
+ free(icu_data_file_default);
+ return result;
+#else
+ return InitializeICU(NULL);
+#endif
+#endif
+}
+
bool InitializeICU(const char* icu_data_file) {
#if !defined(V8_I18N_SUPPORT)
return true;
« no previous file with comments | « src/icu_util.h ('k') | src/snapshot/mksnapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698