mirror of
https://gitee.com/openharmony/third_party_icu
synced 2024-11-23 08:10:07 +00:00
commit
2cd3423e24
2
icu.gni
2
icu.gni
@ -15,4 +15,6 @@ declare_args() {
|
||||
icu_support_locales = true
|
||||
build_feature = "normal"
|
||||
icu_support_libbegetutil = true
|
||||
distro_tzdata_dir = "\"/system/etc/tzdata_distro\""
|
||||
system_tzdata_dir = "\"/system/etc/icu_tzdata\""
|
||||
}
|
||||
|
@ -539,6 +539,8 @@ ohos_shared_library("shared_icuuc") {
|
||||
"UPRV_BLOCK_MACRO_END=",
|
||||
"UCONFIG_USE_WINDOWS_LCID_MAPPING_API=0",
|
||||
"_REENTRANT",
|
||||
"DISTRO_TZDATA_DIR=${distro_tzdata_dir}",
|
||||
"SYSTEM_TZDATA_DIR=${system_tzdata_dir}",
|
||||
]
|
||||
if (!is_mingw) {
|
||||
defines += [ "ICU_SUPPORT_DISTRO" ]
|
||||
|
@ -1308,16 +1308,29 @@ doOpenChoice(const char *path, const char *type, const char *name,
|
||||
|
||||
/**** Time zone individual files override */
|
||||
if (isICUData && isTimeZoneFile(name, type)) {
|
||||
#ifdef DISTRO_TZDATA_DIR
|
||||
const char* distroTzdataDir = DISTRO_TZDATA_DIR;
|
||||
retVal = doLoadFromIndividualFiles(/* pkgName.data() */ "", distroTzdataDir, tocEntryPathSuffix,
|
||||
/* path */ "", type, name, isAcceptable, context, &subErrorCode, pErrorCode);
|
||||
if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
|
||||
return retVal;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SYSTEM_TZDATA_DIR
|
||||
const char* systemTzdataDir = SYSTEM_TZDATA_DIR;
|
||||
retVal = doLoadFromIndividualFiles(/* pkgName.data() */ "", systemTzdataDir, tocEntryPathSuffix,
|
||||
/* path */ "", type, name, isAcceptable, context, &subErrorCode, pErrorCode);
|
||||
if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
|
||||
return retVal;
|
||||
}
|
||||
#endif
|
||||
|
||||
const char *tzFilesDir = u_getTimeZoneFilesDirectory(pErrorCode);
|
||||
if (tzFilesDir[0] != 0) {
|
||||
#ifdef UDATA_DEBUG
|
||||
fprintf(stderr, "Trying Time Zone Files directory = %s\n", tzFilesDir);
|
||||
#endif
|
||||
retVal = doLoadFromIndividualFiles(/* pkgName.data() */ "", tzFilesDir, tocEntryPathSuffix,
|
||||
/* path */ "", type, name, isAcceptable, context, &subErrorCode, pErrorCode);
|
||||
if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
|
||||
return retVal;
|
||||
}
|
||||
retVal = doLoadFromCommonData(isICUData,
|
||||
"icu_tzdata", tzFilesDir, tocEntryPathSuffix, tocEntryName.data(),
|
||||
"icu_tzdata", type, name, isAcceptable, context, &subErrorCode, pErrorCode);
|
||||
|
@ -22,20 +22,14 @@
|
||||
namespace OHOS {
|
||||
namespace Global {
|
||||
namespace I18n {
|
||||
const char *DistroTZDataLoader::ICU_TZDATA_PATH = "/system/etc/tzdata_distro/icu/icu_tzdata.dat";
|
||||
const char *DistroTZDataLoader::DISTRO_TZDATA_PATH = "/system/etc/tzdata_distro/icu";
|
||||
const char *DistroTZDataLoader::ICU_TZDATA_PATH = "/system/etc/tzdata_distro/icu_tzdata.dat";
|
||||
const char *DistroTZDataLoader::DISTRO_TZDATA_PATH = "/system/etc/tzdata_distro";
|
||||
const char *DistroTZDataLoader::TZDATA_PATH = "/system/etc/icu_tzdata";
|
||||
const char *DistroTZDataLoader::ICU_TIMEZONE_FILES_DIR = "ICU_TIMEZONE_FILES_DIR";
|
||||
|
||||
void DistroTZDataLoader::SetDistroTZDataPath()
|
||||
{
|
||||
#ifdef ICU_SUPPORT_DISTRO
|
||||
// if distro_tzdata_path is exist, use distro tzdata first
|
||||
if (CheckFileExist()) {
|
||||
setenv(ICU_TIMEZONE_FILES_DIR, DISTRO_TZDATA_PATH, 1);
|
||||
} else {
|
||||
setenv(ICU_TIMEZONE_FILES_DIR, TZDATA_PATH, 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user