Fixing 38767. Allows C: to be a valid path to InitWithPath();

This commit is contained in:
dougt%netscape.com 2000-05-17 00:29:59 +00:00
Родитель e56e2ccb26
Коммит 0a752c90da
1 изменённых файлов: 10 добавлений и 1 удалений

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

@ -591,8 +591,17 @@ nsLocalFile::InitWithPath(const char *filePath)
// just do a sanity check. if it has any forward slashes, it is not a Native path // just do a sanity check. if it has any forward slashes, it is not a Native path
// on windows. Also, it must have a colon at after the first char. // on windows. Also, it must have a colon at after the first char.
if (filePath[0] == 0)
return NS_ERROR_FAILURE;
if ( (filePath[2] == 0) && (filePath[1] == ':') )
{
nativeFilePath = (char*) nsAllocator::Clone( filePath, 4 );
// C : //
nativeFilePath[2] = '\\';
}
if ( ( (filePath[0] != 0) && (filePath[1] == ':') && (strchr(filePath, '/') == 0) ) || // normal windows path if ( ( (filePath[1] == ':') && (strchr(filePath, '/') == 0) ) || // normal windows path
( (filePath[0] == '\\') && (filePath[1] == '\\') ) ) // netwerk path ( (filePath[0] == '\\') && (filePath[1] == '\\') ) ) // netwerk path
{ {
// This is a native path // This is a native path