ICU-87 rename icu_getDefaultDataDirectory() to u_[get|set]DataDirectory()
X-SVN-Rev: 184
This commit is contained in:
parent
a05544211a
commit
9e4c1ad754
@ -135,8 +135,11 @@ U_CAPI char* U_EXPORT2 icu_tzname(int index);
|
||||
/* Get UTC (GMT) time measured in seconds since 0:00 on 1/1/70. */
|
||||
U_CAPI int32_t U_EXPORT2 icu_getUTCtime(void);
|
||||
|
||||
/* Return the default data directory for this platform. See Locale. */
|
||||
U_CAPI const char* U_EXPORT2 icu_getDefaultDataDirectory(void);
|
||||
/* Return the data directory for this platform. */
|
||||
U_CAPI const char* U_EXPORT2 u_getDataDirectory(void);
|
||||
|
||||
/* Set the data directory. */
|
||||
U_CAPI void U_EXPORT2 u_setDataDirectory(const char *directory);
|
||||
|
||||
/* Return the default codepage for this platform and locale */
|
||||
U_CAPI const char* U_EXPORT2 icu_getDefaultCodepage(void);
|
||||
@ -155,8 +158,25 @@ U_CAPI const char* U_EXPORT2 icu_getDefaultLocaleID(void);
|
||||
*/
|
||||
U_CAPI double U_EXPORT2 icu_nextDouble(double d, bool_t positive);
|
||||
|
||||
/*
|
||||
* Filesystem file and path separator characters.
|
||||
* Example: '/' and ':' on Unix, '\\' and ';' on Windows.
|
||||
*/
|
||||
#ifdef XP_MAC
|
||||
# define U_FILE_SEP_CHAR ':'
|
||||
# define U_PATH_SEP_CHAR ';'
|
||||
# define U_FILE_SEP_STRING ":"
|
||||
# define U_PATH_SEP_STRING ";"
|
||||
#elif defined(WIN32) || defined(OS2)
|
||||
# define U_FILE_SEP_CHAR '\\'
|
||||
# define U_PATH_SEP_CHAR ';'
|
||||
# define U_FILE_SEP_STRING "\\"
|
||||
# define U_PATH_SEP_STRING ";"
|
||||
#else
|
||||
# define U_FILE_SEP_CHAR '/'
|
||||
# define U_PATH_SEP_CHAR ':'
|
||||
# define U_FILE_SEP_STRING "/"
|
||||
# define U_PATH_SEP_STRING ":"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -65,7 +65,6 @@ static const UChar closeParen[] = { (UChar)0x0029 /* ( */, (UChar)0x0000};
|
||||
|
||||
|
||||
static char* _defaultLocale = NULL;
|
||||
static char* _dataDirectory = NULL;
|
||||
|
||||
static char** _installedLocales = NULL;
|
||||
static int32_t _installedLocalesCount = 0;
|
||||
@ -1166,28 +1165,11 @@ const char* const* uloc_getISOCountries()
|
||||
const char*
|
||||
uloc_getDataDirectory()
|
||||
{
|
||||
if (_dataDirectory == NULL)
|
||||
{
|
||||
uloc_setDataDirectory(icu_getDefaultDataDirectory());
|
||||
}
|
||||
return _dataDirectory;
|
||||
return u_getDataDirectory();
|
||||
}
|
||||
|
||||
void
|
||||
uloc_setDataDirectory(const char* newDirectory)
|
||||
{
|
||||
char* newDataDirectory = (char*) icu_malloc(sizeof(char)*(icu_strlen(newDirectory) + 1));
|
||||
icu_strcpy(newDataDirectory, newDirectory);
|
||||
|
||||
{
|
||||
umtx_lock(NULL);
|
||||
|
||||
if(_dataDirectory != NULL)
|
||||
icu_free(_dataDirectory);
|
||||
_dataDirectory = newDataDirectory;
|
||||
if(_installedLocales != NULL)
|
||||
icu_free(_installedLocales);
|
||||
_installedLocales = NULL;
|
||||
umtx_unlock(NULL);
|
||||
}
|
||||
u_setDataDirectory(newDirectory);
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ void TestUnicodeData()
|
||||
const char *expectVersion = "3.0.0"; /* NOTE: this purposely breaks to force the tests to stay in sync with the unicodedata */
|
||||
char expectString[256];
|
||||
|
||||
strcpy(newPath,icu_getDefaultDataDirectory());
|
||||
strcpy(newPath, u_getDataDirectory());
|
||||
strcat(newPath, "UnicodeData-");
|
||||
strcat(newPath, expectVersion);
|
||||
strcat(newPath, ".txt");
|
||||
|
@ -430,7 +430,7 @@ void DateFormatRegressionTest::Test4065240()
|
||||
|
||||
// Check to see if the resource is present; if not, we can't test
|
||||
ResourceBundle *bundle = new ResourceBundle(
|
||||
icu_getDefaultDataDirectory(), *curLocale, status);
|
||||
u_getDataDirectory(), *curLocale, status);
|
||||
failure(status, "new ResourceBundle");
|
||||
//(UnicodeString) "java.text.resources.DateFormatZoneData", curLocale);
|
||||
|
||||
|
@ -1397,7 +1397,7 @@ void NumberFormatRegressionTest::Test4122840()
|
||||
for (int i = 0; i < count; i++) {
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
ResourceBundle *rb = new ResourceBundle(
|
||||
icu_getDefaultDataDirectory()/*"java.text.resources.LocaleElements"*/,
|
||||
u_getDataDirectory()/*"java.text.resources.LocaleElements"*/,
|
||||
locales[i], status);
|
||||
failure(status, "new ResourceBundle");
|
||||
//
|
||||
|
@ -304,7 +304,7 @@ void UnicodeTest::TestUnicodeData()
|
||||
char path[256];
|
||||
const char* datafile = "UnicodeData-3.0.0.txt";
|
||||
|
||||
strcpy(path , icu_getDefaultDataDirectory());
|
||||
strcpy(path, u_getDataDirectory());
|
||||
strcat(path, datafile);
|
||||
|
||||
input = fopen( path, "r");
|
||||
|
Loading…
Reference in New Issue
Block a user