Bug 105151; check for ERROR_INVALID_PARAMATER and retry with empty file name (because we get that when the file name is too long); r=bryner, sr=hyatt

This commit is contained in:
law%netscape.com 2001-12-07 00:26:59 +00:00
Родитель 0e2e20f34f
Коммит 87e765c949
1 изменённых файлов: 10 добавлений и 0 удалений

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

@ -187,6 +187,16 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval)
}
else if (mMode == modeSave) {
result = ::GetSaveFileName(&ofn);
if (!result) {
// Error, find out what kind.
DWORD error = ::GetLastError();
if (error == ERROR_INVALID_PARAMETER) {
// Parameter error; probably the default file name is too long.
// Try again, without a starting file name.
ofn.lpstrFile[0] = 0;
result = ::GetSaveFileName(&ofn);
}
}
}
else {
NS_ASSERTION(0, "Only load, save and getFolder are supported modes");