Removing existing check when creating subdirectories.
This commit is contained in:
dougt%netscape.com 1999-04-10 00:29:20 +00:00
Родитель 85bcdf7d37
Коммит ddc1a6b6ba
2 изменённых файлов: 92 добавлений и 12 удалений

Просмотреть файл

@ -413,12 +413,8 @@ void nsFileSpecHelpers::MakeAllDirectories(const char* inPath, int mode)
// then make a directory (We cannot make the initial (volume) node).
if (!spec.Exists() && *currentStart != kSeparator)
spec.CreateDirectory(mode);
if (!spec.Exists())
{
NS_ASSERTION(spec.Exists(), "Could not create the directory?");
break;
}
currentStart = ++currentEnd;
currentStart = ++currentEnd;
currentEnd = strchr(currentStart, kSeparator);
if (!currentEnd)
break;
@ -1148,3 +1144,47 @@ nsAutoCString::~nsAutoCString()
{
delete [] (char*)mCString;
}
//========================================================================================
// class nsprPath
//========================================================================================
//----------------------------------------------------------------------------------------
nsprPath::operator const char*()
//----------------------------------------------------------------------------------------
{
#ifdef XP_PC
if (modifiedNSPRPath != nsnull)
delete [] modifiedNSPRPath;
modifiedNSPRPath = strdup( mFilePath );
char* resultPath = modifiedNSPRPath;
/* strip the leading seperator */
if(resultPath[0] == '/')
resultPath = resultPath + 1;
/* Replace the bar */
if(resultPath[1] == '|')
resultPath[1] = ':';
/* Remove the ending seperator */
if(resultPath[strlen(resultPath) - 1 ] == '/')
resultPath[strlen(resultPath) - 1 ] = '\0';
return resultPath;
#else
return mFilePath;
#endif
}
//----------------------------------------------------------------------------------------
nsprPath::~nsprPath()
//----------------------------------------------------------------------------------------
{
if (modifiedNSPRPath != nsnull)
delete [] modifiedNSPRPath;
}

Просмотреть файл

@ -413,12 +413,8 @@ void nsFileSpecHelpers::MakeAllDirectories(const char* inPath, int mode)
// then make a directory (We cannot make the initial (volume) node).
if (!spec.Exists() && *currentStart != kSeparator)
spec.CreateDirectory(mode);
if (!spec.Exists())
{
NS_ASSERTION(spec.Exists(), "Could not create the directory?");
break;
}
currentStart = ++currentEnd;
currentStart = ++currentEnd;
currentEnd = strchr(currentStart, kSeparator);
if (!currentEnd)
break;
@ -1148,3 +1144,47 @@ nsAutoCString::~nsAutoCString()
{
delete [] (char*)mCString;
}
//========================================================================================
// class nsprPath
//========================================================================================
//----------------------------------------------------------------------------------------
nsprPath::operator const char*()
//----------------------------------------------------------------------------------------
{
#ifdef XP_PC
if (modifiedNSPRPath != nsnull)
delete [] modifiedNSPRPath;
modifiedNSPRPath = strdup( mFilePath );
char* resultPath = modifiedNSPRPath;
/* strip the leading seperator */
if(resultPath[0] == '/')
resultPath = resultPath + 1;
/* Replace the bar */
if(resultPath[1] == '|')
resultPath[1] = ':';
/* Remove the ending seperator */
if(resultPath[strlen(resultPath) - 1 ] == '/')
resultPath[strlen(resultPath) - 1 ] = '\0';
return resultPath;
#else
return mFilePath;
#endif
}
//----------------------------------------------------------------------------------------
nsprPath::~nsprPath()
//----------------------------------------------------------------------------------------
{
if (modifiedNSPRPath != nsnull)
delete [] modifiedNSPRPath;
}