Fixed saving over existing file bug 66745. r,m=Makoto Hamanaka (VYA04230@nifty.com), sr=sfraser.'

This commit is contained in:
cmanske%netscape.com 2001-02-06 04:38:08 +00:00
Родитель c5fd5ae0d3
Коммит 36637accb4
1 изменённых файлов: 22 добавлений и 5 удалений

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

@ -178,11 +178,28 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval)
ppanel->Quit(); ppanel->Quit();
} }
if (result) if (result) {
*retval = returnOK; PRInt16 returnOKorReplace = returnOK;
else
*retval = returnCancel; if (mMode == modeSave) {
// Windows does not return resultReplace,
// we must check if file already exists
nsCOMPtr<nsILocalFile> file(do_CreateInstance("@mozilla.org/file/local;1"));
NS_ENSURE_TRUE(file, NS_ERROR_FAILURE);
file->InitWithPath(mFile);
PRBool exists = PR_FALSE;
file->Exists(&exists);
if (exists)
returnOKorReplace = returnReplace;
}
*retval = returnOKorReplace;
}
else {
*retval = returnCancel;
}
return NS_OK; return NS_OK;
// TODO: implement filters // TODO: implement filters