From 2dbf9ea34cc3168ec99ddd292a6f6f5219c3db9f Mon Sep 17 00:00:00 2001 From: Mehmet Yasar Date: Tue, 26 Mar 2002 19:47:40 +0000 Subject: [PATCH] Fix default extension behavior with GetOpenFileName. --- dlls/commdlg/filedlg95.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/commdlg/filedlg95.c b/dlls/commdlg/filedlg95.c index 5aa9827f276..c6e18c1ef74 100644 --- a/dlls/commdlg/filedlg95.c +++ b/dlls/commdlg/filedlg95.c @@ -1528,8 +1528,15 @@ BOOL FILEDLG95_OnOpen(HWND hwnd) /* only add "." in case a default extension does exist */ if (*fodInfos->ofnInfos->lpstrDefExt != '\0') { + int PathLength; + PathLength = strlen(lpstrPathAndFile); + strcat(lpstrPathAndFile, "."); strcat(lpstrPathAndFile, fodInfos->ofnInfos->lpstrDefExt); + + /* if file does not exist try without extension */ + if (!PathFileExistsA(lpstrPathAndFile)) + lpstrPathAndFile[PathLength] = '\0'; } } }