InitWithPath should not store trailing seperatores in paths. It really is

an error to pass a trailing seperator, but we are just being kind.
This commit is contained in:
dougt%netscape.com 2000-05-09 23:53:03 +00:00
Родитель d1222eebcd
Коммит 8104407afa
1 изменённых файлов: 10 добавлений и 1 удалений

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

@ -268,7 +268,16 @@ NS_IMETHODIMP
nsLocalFile::InitWithPath(const char *filePath)
{
NS_ENSURE_ARG(filePath);
mPath = filePath;
int len = strlen(filePath);
char* name = (char*) nsAllocator::Clone( filePath, len+1 );
if(name[len-1] == '/')
name[len-1] = '\0';
mPath = name;
nsAllocator::Free(name);
InvalidateCache();
return NS_OK;
}