ICU-2850 __FILE__ doesn't contain the directory in release mode.

X-SVN-Rev: 12214
This commit is contained in:
George Rhoten 2003-06-02 03:38:31 +00:00
parent f2f4d951c3
commit a7f14cf71b
2 changed files with 14 additions and 15 deletions

View file

@ -299,7 +299,7 @@ const char * ctest_dataSrcDir()
{
static const char *dataSrcDir = NULL;
if(dataSrcDir != NULL) {
if(dataSrcDir) {
return dataSrcDir;
}
@ -322,10 +322,11 @@ const char * ctest_dataSrcDir()
* Change to "wherever\icu\source\data"
*/
{
static char p[sizeof(__FILE__) + 10];
static char p[sizeof(__FILE__) + 20];
char *pBackSlash;
int i;
dataSrcDir = p;
strcpy(p, __FILE__);
/* We want to back over three '\' chars. */
/* Only Windows should end up here, so looking for '\' is safe. */
@ -341,7 +342,10 @@ const char * ctest_dataSrcDir()
* Now append "source\data" and set the environment
*/
strcpy(pBackSlash, U_FILE_SEP_STRING "data" U_FILE_SEP_STRING );
dataSrcDir = p;
}
else {
/* __FILE__ on MSVC7 does not contain the directory */
strcpy(p, ".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING "data" U_FILE_SEP_STRING);
}
}
#endif
@ -378,10 +382,11 @@ const char *ctest_dataOutDir()
* Change to "wherever\icu\source\data"
*/
{
static char p[sizeof(__FILE__) + 10];
static char p[sizeof(__FILE__) + 20];
char *pBackSlash;
int i;
dataOutDir = p;
strcpy(p, __FILE__);
/* We want to back over three '\' chars. */
/* Only Windows should end up here, so looking for '\' is safe. */
@ -397,13 +402,15 @@ const char *ctest_dataOutDir()
* Now append "source\data" and set the environment
*/
strcpy(pBackSlash, U_FILE_SEP_STRING "data" U_FILE_SEP_STRING "out" U_FILE_SEP_STRING);
dataOutDir = p;
}
else {
/* __FILE__ on MSVC7 does not contain the directory */
strcpy(p, ".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING "data" U_FILE_SEP_STRING "out" U_FILE_SEP_STRING);
}
}
#endif
return dataOutDir;
}
/* ctest_setICU_DATA - if the ICU_DATA environment variable is not already

View file

@ -1146,15 +1146,7 @@ static void TestUnicodeData()
/* As a fallback, try to guess where the source data was located
* at the time ICU was built, and look there.
*/
#if defined (U_TOPSRCDIR)
strcpy(backupPath, U_TOPSRCDIR U_FILE_SEP_STRING "data");
#else
strcpy(backupPath, __FILE__);
strrchr(backupPath, U_FILE_SEP_CHAR)[0] = 0; /* Remove the file name */
strrchr(backupPath, U_FILE_SEP_CHAR)[0] = 0; /* Previous directory */
strrchr(backupPath, U_FILE_SEP_CHAR)[0] = 0; /* Previous directory */
strcat(backupPath, U_FILE_SEP_STRING "data");
#endif
strcpy(backupPath, ctest_dataSrcDir());
strcat(backupPath, U_FILE_SEP_STRING);
strcat(backupPath, "unidata" U_FILE_SEP_STRING "UnicodeData.txt");