ICU-20895 ICU_TIMEZONE_FILES_DIR_PREFIX_ENV_VAR
Adds `ICU_TIMEZONE_FILES_DIR_PREFIX_ENV_VAR`, similar to `ICU_DATA_DIR_PREFIX_ENV_VAR`, that specifies an environment variable to retrieve and prepend to the ICU time zone data file path.
This commit is contained in:
parent
6ea0fc7713
commit
cd41cba82a
@ -1459,6 +1459,11 @@ static void U_CALLCONV TimeZoneDataDirInitFn(UErrorCode &status) {
|
||||
|
||||
const char *dir = "";
|
||||
|
||||
#if defined(ICU_TIMEZONE_FILES_DIR_PREFIX_ENV_VAR)
|
||||
char timezonefilesdir_path_buffer[PATH_MAX];
|
||||
const char *prefix = getenv(ICU_TIMEZONE_FILES_DIR_PREFIX_ENV_VAR);
|
||||
#endif
|
||||
|
||||
#if U_PLATFORM_HAS_WINUWP_API == 1
|
||||
// The UWP version does not support the environment variable setting.
|
||||
|
||||
@ -1485,6 +1490,13 @@ static void U_CALLCONV TimeZoneDataDirInitFn(UErrorCode &status) {
|
||||
dir = "";
|
||||
}
|
||||
|
||||
#if defined(ICU_TIMEZONE_FILES_DIR_PREFIX_ENV_VAR)
|
||||
if (prefix != NULL) {
|
||||
snprintf(timezonefilesdir_path_buffer, PATH_MAX, "%s%s", prefix, dir);
|
||||
dir = timezonefilesdir_path_buffer;
|
||||
}
|
||||
#endif
|
||||
|
||||
setTimeZoneFilesDir(dir, status);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user