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