diff --git a/icu4c/source/tools/toolutil/unewdata.c b/icu4c/source/tools/toolutil/unewdata.c index a866ac9684..75f38289d5 100644 --- a/icu4c/source/tools/toolutil/unewdata.c +++ b/icu4c/source/tools/toolutil/unewdata.c @@ -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: + * + */ diff --git a/icu4c/source/tools/toolutil/unewdata.h b/icu4c/source/tools/toolutil/unewdata.h index 9f10f3925a..ccabcde4c5 100644 --- a/icu4c/source/tools/toolutil/unewdata.h +++ b/icu4c/source/tools/toolutil/unewdata.h @@ -54,7 +54,7 @@ typedef struct UNewDataMemory UNewDataMemory; * @param pErrorCode An ICU UErrorCode parameter. It must not be NULL. */ 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