From ab32395a4f5035a03845fba815d1e7ccf784a28f Mon Sep 17 00:00:00 2001 From: Michael Ow Date: Thu, 10 Nov 2011 23:11:19 +0000 Subject: [PATCH] ICU-8928 Fix how path is found when pkgdata needs icu-config X-SVN-Rev: 30949 --- icu4c/source/test/cintltst/putiltst.c | 14 +------------- icu4c/source/tools/pkgdata/pkgdata.cpp | 4 +++- icu4c/source/tools/toolutil/toolutil.cpp | 6 +++--- icu4c/source/tools/toolutil/toolutil.h | 2 +- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/icu4c/source/test/cintltst/putiltst.c b/icu4c/source/test/cintltst/putiltst.c index d9da7fad932..d4a3a466608 100644 --- a/icu4c/source/test/cintltst/putiltst.c +++ b/icu4c/source/test/cintltst/putiltst.c @@ -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])); diff --git a/icu4c/source/tools/pkgdata/pkgdata.cpp b/icu4c/source/tools/pkgdata/pkgdata.cpp index 5ca6082ab35..af9cf4ee961 100644 --- a/icu4c/source/tools/pkgdata/pkgdata.cpp +++ b/icu4c/source/tools/pkgdata/pkgdata.cpp @@ -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) { diff --git a/icu4c/source/tools/toolutil/toolutil.cpp b/icu4c/source/tools/toolutil/toolutil.cpp index b42044ed7fe..7c02efc37b1 100644 --- a/icu4c/source/tools/toolutil/toolutil.cpp +++ b/icu4c/source/tools/toolutil/toolutil.cpp @@ -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; diff --git a/icu4c/source/tools/toolutil/toolutil.h b/icu4c/source/tools/toolutil/toolutil.h index 360b13833f9..7b93211c2b9 100644 --- a/icu4c/source/tools/toolutil/toolutil.h +++ b/icu4c/source/tools/toolutil/toolutil.h @@ -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 -- 2.40.0