comdlg32: GetSaveFileName: Don't append .* extension.

This commit is contained in:
Eryk Wieliczko 2010-11-01 12:35:43 +01:00 committed by Alexandre Julliard
parent a7cf4d16fa
commit bd0fe7d26b
1 changed files with 12 additions and 6 deletions

View File

@ -2474,14 +2474,11 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
/* if no extension is specified with file name, then */
/* attach the extension from file filter or default one */
WCHAR *filterExt = NULL;
const WCHAR *filterExt = NULL;
LPWSTR lpstrFilter = NULL;
static const WCHAR szwDot[] = {'.',0};
int PathLength = lstrlenW(lpstrPathAndFile);
/* Attach the dot*/
lstrcatW(lpstrPathAndFile, szwDot);
/*Get the file extension from file type filter*/
lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
fodInfos->ofnInfos->nFilterIndex-1);
@ -2490,9 +2487,18 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
filterExt = PathFindExtensionW(lpstrFilter);
if ( filterExt && *filterExt ) /* attach the file extension from file type filter*/
lstrcatW(lpstrPathAndFile, filterExt + 1);
filterExt = filterExt + 1;
else if ( fodInfos->defext ) /* attach the default file extension*/
lstrcatW(lpstrPathAndFile, fodInfos->defext);
filterExt = fodInfos->defext;
/* If extension is .*, ignore it */
if (filterExt[0] != '*')
{
/* Attach the dot*/
lstrcatW(lpstrPathAndFile, szwDot);
/* Attach the extension */
lstrcatW(lpstrPathAndFile, filterExt );
}
/* In Open dialog: if file does not exist try without extension */
if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) && !PathFileExistsW(lpstrPathAndFile))