From b949367c6bf1d140ae1d57b606d4d27698c4e4cb Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Fri, 19 Nov 1999 00:59:57 +0000 Subject: [PATCH] ICU-87 improve hardcoded fallback data path X-SVN-Rev: 185 --- icu4c/source/common/putil.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/icu4c/source/common/putil.c b/icu4c/source/common/putil.c index 09e69f3a445..d4e0ccca123 100644 --- a/icu4c/source/common/putil.c +++ b/icu4c/source/common/putil.c @@ -954,6 +954,9 @@ findLibraryPath(char *path, int size) { return 0; } +/* define a path for fallbacks */ +#define FALLBACK_PATH U_FILE_SEP_STRING "share" U_FILE_SEP_STRING "icu" U_FILE_SEP_STRING ICU_VERSION U_FILE_SEP_STRING + U_CAPI const char * U_EXPORT2 u_getDataDirectory(void) { /* if we have the directory, then return it immediately */ @@ -1002,7 +1005,7 @@ u_getDataDirectory(void) { if(path==NULL || *path==0) { length=getLibraryPath(pathBuffer, sizeof(pathBuffer)); if(length>0) { - icu_strcpy(pathBuffer+length, U_FILE_SEP_STRING "icu" U_FILE_SEP_STRING "data" U_FILE_SEP_STRING); + icu_strcpy(pathBuffer+length, U_FILE_SEP_STRING ".." FALLBACK_PATH); path=pathBuffer; } } @@ -1011,7 +1014,7 @@ u_getDataDirectory(void) { if(path==NULL || *path==0) { length=findLibraryPath(pathBuffer, sizeof(pathBuffer)); if(length>0) { - icu_strcpy(pathBuffer+length, U_FILE_SEP_STRING "icu" U_FILE_SEP_STRING "data" U_FILE_SEP_STRING); + icu_strcpy(pathBuffer+length, U_FILE_SEP_STRING ".." FALLBACK_PATH); path=pathBuffer; } } @@ -1024,10 +1027,10 @@ u_getDataDirectory(void) { # else length=getSystemPath(pathBuffer, sizeof(pathBuffer)); if(length>0) { - icu_strcpy(pathBuffer+length, U_FILE_SEP_STRING "icu" U_FILE_SEP_STRING "data" U_FILE_SEP_STRING); + icu_strcpy(pathBuffer+length, FALLBACK_PATH); path=pathBuffer; } else { - path=U_FILE_SEP_STRING "icu" U_FILE_SEP_STRING "data" U_FILE_SEP_STRING; + path=FALLBACK_PATH; } # endif }