ICU-282 added a directory argument to udata_create(), defaulting to

u_getDataDir() if 0.

X-SVN-Rev: 864
This commit is contained in:
Yves Arrouye 2000-02-29 18:33:01 +00:00
parent db6d551cda
commit 7039dc422a
2 changed files with 31 additions and 6 deletions

View File

@ -29,13 +29,12 @@ struct UNewDataMemory {
};
U_CAPI UNewDataMemory * U_EXPORT2
udata_create(const char *type, const char *name,
udata_create(const char *type, const char *name, const char *dir,
const UDataInfo *pInfo,
const char *comment,
UErrorCode *pErrorCode) {
UNewDataMemory *pData;
uint16_t headerSize, commentLength;
const char *path;
char filename[512];
uint8_t bytes[16];
@ -54,9 +53,16 @@ udata_create(const char *type, const char *name,
}
/* open the output file */
path=u_getDataDirectory();
if(path!=NULL) {
uprv_strcpy(filename, path);
if(dir==NULL) {
dir=u_getDataDirectory();
}
if(dir!=NULL && *dir) {
char *p = filename + strlen(dir) - 1;
uprv_strcpy(filename, dir);
if (*p != U_FILE_SEP_CHAR) {
*++p = U_FILE_SEP_CHAR;
*p = 0;
}
} else {
filename[0]=0;
}
@ -203,3 +209,12 @@ udata_writeUString(UNewDataMemory *pData, const UChar *s, UTextOffset length) {
}
}
}
/*
* Hey, Emacs, please set the following:
*
* Local Variables:
* indent-tabs-mode: nil
* End:
*
*/

View File

@ -54,7 +54,7 @@ typedef struct UNewDataMemory UNewDataMemory;
* @param pErrorCode An ICU UErrorCode parameter. It must not be <code>NULL</code>.
*/
U_CAPI UNewDataMemory * U_EXPORT2
udata_create(const char *type, const char *name,
udata_create(const char *type, const char *name, const char *dir,
const UDataInfo *pInfo,
const char *comment,
UErrorCode *pErrorCode);
@ -91,4 +91,14 @@ udata_writeString(UNewDataMemory *pData, const char *s, UTextOffset length);
U_CAPI void U_EXPORT2
udata_writeUString(UNewDataMemory *pData, const UChar *s, UTextOffset length);
/*
* Hey, Emacs, please set the following:
*
* Local Variables:
* indent-tabs-mode: nil
* End:
*
*/
#endif