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
|
icu_support_locales = true
|
||||||
build_feature = "normal"
|
build_feature = "normal"
|
||||||
icu_support_libbegetutil = true
|
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=",
|
"UPRV_BLOCK_MACRO_END=",
|
||||||
"UCONFIG_USE_WINDOWS_LCID_MAPPING_API=0",
|
"UCONFIG_USE_WINDOWS_LCID_MAPPING_API=0",
|
||||||
"_REENTRANT",
|
"_REENTRANT",
|
||||||
|
"DISTRO_TZDATA_DIR=${distro_tzdata_dir}",
|
||||||
|
"SYSTEM_TZDATA_DIR=${system_tzdata_dir}",
|
||||||
]
|
]
|
||||||
if (!is_mingw) {
|
if (!is_mingw) {
|
||||||
defines += [ "ICU_SUPPORT_DISTRO" ]
|
defines += [ "ICU_SUPPORT_DISTRO" ]
|
||||||
|
@ -1308,16 +1308,29 @@ doOpenChoice(const char *path, const char *type, const char *name,
|
|||||||
|
|
||||||
/**** Time zone individual files override */
|
/**** Time zone individual files override */
|
||||||
if (isICUData && isTimeZoneFile(name, type)) {
|
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);
|
const char *tzFilesDir = u_getTimeZoneFilesDirectory(pErrorCode);
|
||||||
if (tzFilesDir[0] != 0) {
|
if (tzFilesDir[0] != 0) {
|
||||||
#ifdef UDATA_DEBUG
|
#ifdef UDATA_DEBUG
|
||||||
fprintf(stderr, "Trying Time Zone Files directory = %s\n", tzFilesDir);
|
fprintf(stderr, "Trying Time Zone Files directory = %s\n", tzFilesDir);
|
||||||
#endif
|
#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,
|
retVal = doLoadFromCommonData(isICUData,
|
||||||
"icu_tzdata", tzFilesDir, tocEntryPathSuffix, tocEntryName.data(),
|
"icu_tzdata", tzFilesDir, tocEntryPathSuffix, tocEntryName.data(),
|
||||||
"icu_tzdata", type, name, isAcceptable, context, &subErrorCode, pErrorCode);
|
"icu_tzdata", type, name, isAcceptable, context, &subErrorCode, pErrorCode);
|
||||||
|
@ -22,20 +22,14 @@
|
|||||||
namespace OHOS {
|
namespace OHOS {
|
||||||
namespace Global {
|
namespace Global {
|
||||||
namespace I18n {
|
namespace I18n {
|
||||||
const char *DistroTZDataLoader::ICU_TZDATA_PATH = "/system/etc/tzdata_distro/icu/icu_tzdata.dat";
|
const char *DistroTZDataLoader::ICU_TZDATA_PATH = "/system/etc/tzdata_distro/icu_tzdata.dat";
|
||||||
const char *DistroTZDataLoader::DISTRO_TZDATA_PATH = "/system/etc/tzdata_distro/icu";
|
const char *DistroTZDataLoader::DISTRO_TZDATA_PATH = "/system/etc/tzdata_distro";
|
||||||
const char *DistroTZDataLoader::TZDATA_PATH = "/system/etc/icu_tzdata";
|
const char *DistroTZDataLoader::TZDATA_PATH = "/system/etc/icu_tzdata";
|
||||||
const char *DistroTZDataLoader::ICU_TIMEZONE_FILES_DIR = "ICU_TIMEZONE_FILES_DIR";
|
const char *DistroTZDataLoader::ICU_TIMEZONE_FILES_DIR = "ICU_TIMEZONE_FILES_DIR";
|
||||||
|
|
||||||
void DistroTZDataLoader::SetDistroTZDataPath()
|
void DistroTZDataLoader::SetDistroTZDataPath()
|
||||||
{
|
{
|
||||||
#ifdef ICU_SUPPORT_DISTRO
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user