ICU-8928 Fix how path is found when pkgdata needs icu-config

X-SVN-Rev: 30949
This commit is contained in:
Michael Ow 2011-11-10 23:11:19 +00:00
parent 895e909e90
commit ab32395a4f
4 changed files with 8 additions and 18 deletions

View file

@ -638,23 +638,11 @@ static void toolutil_findDirname(void)
U_BUFFER_OVERFLOW_ERROR,
NULL
},
{
"pkgdata",
1,
U_BUFFER_OVERFLOW_ERROR,
NULL
},
{
"pkgdata",
2,
U_ZERO_ERROR,
"."
},
{
"pkgdata",
20,
U_ZERO_ERROR,
"."
""
}
};
int32_t count=(sizeof(testCases)/sizeof(testCases[0]));

View file

@ -1873,7 +1873,9 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
/* #1 try the same path where pkgdata was called from. */
findDirname(progname, cmdBuf, 1024, &status);
if(U_SUCCESS(status)) {
uprv_strncat(cmdBuf, U_FILE_SEP_STRING, 1024);
if (cmdBuf[0] != 0) {
uprv_strncat(cmdBuf, U_FILE_SEP_STRING, 1024);
}
uprv_strncat(cmdBuf, cmd, 1024);
if(verbose) {

View file

@ -125,9 +125,9 @@ findDirname(const char *path, char *buffer, int32_t bufLen, UErrorCode* status)
}
#endif
if(!basename) {
/* no basename - return '.'. */
resultPtr = ".";
resultLen = 1;
/* no basename - return ''. */
resultPtr = "";
resultLen = 0;
} else {
resultPtr = path;
resultLen = basename - path;

View file

@ -84,7 +84,7 @@ findBasename(const char *filename);
* If successful, copies the directory name into the output buffer along with
* a terminating NULL.
*
* If there isn't a directory name in the path, it returns the current directory string ('.').
* If there isn't a directory name in the path, it returns an empty string.
* @param path the full pathname to inspect.
* @param buffer the output buffer
* @param bufLen the output buffer length