fixing bug #21085. xpinstall now quits gracefully when destination file already exists in a file move and file copy operation. r=cathleen

This commit is contained in:
ssu%netscape.com 2000-01-15 06:01:39 +00:00
Родитель 75c9537a73
Коммит 0f2779b74e
1 изменённых файлов: 23 добавлений и 1 удалений

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

@ -640,6 +640,16 @@ nsInstallFileOpItem::NativeFileOpFileCopyPrepare()
return nsInstall::DOES_NOT_EXIST; return nsInstall::DOES_NOT_EXIST;
else if(mTarget->IsFile()) else if(mTarget->IsFile())
return nsInstall::IS_FILE; return nsInstall::IS_FILE;
else
{
nsFileSpec tempVar;
tempVar = *mTarget;
tempVar += mSrc->GetLeafName();
if(tempVar.Exists())
return nsInstall::ALREADY_EXISTS;
}
return nsInstall::SUCCESS; return nsInstall::SUCCESS;
} }
@ -749,8 +759,20 @@ nsInstallFileOpItem::NativeFileOpFileMovePrepare()
{ {
if(!mTarget->Exists()) if(!mTarget->Exists())
return nsInstall::DOES_NOT_EXIST; return nsInstall::DOES_NOT_EXIST;
else if(mTarget->IsFile())
return nsInstall::IS_FILE;
else else
return NativeFileOpFileCopyPrepare(); {
nsFileSpec tempVar;
tempVar = *mTarget;
tempVar += mSrc->GetLeafName();
if(tempVar.Exists())
return nsInstall::ALREADY_EXISTS;
else
return NativeFileOpFileCopyPrepare();
}
} }
return nsInstall::SOURCE_DOES_NOT_EXIST; return nsInstall::SOURCE_DOES_NOT_EXIST;