Fix default extension behavior with GetOpenFileName

mehmet yasar myasar at free.fr
Tue Mar 26 10:20:24 CST 2002


Hi,

If a default extension was given, Wine could not open files without
extension. Now it works better, for example with default extension "txt" :

If you type "filename", we will try first "filename.txt" and then
"filename" if the previous doesn't exist.

TODO :
If you type "filename" (with quotes) and there is "filename" and
"filename.txt" in the same directory, we should open "filename".
(The same logic applies when selecting file on listview with mouse)

Changelog:
          Fix default extension behavior with GetOpenFileName





-------------- next part --------------
diff -ur CVS/wine/dlls/commdlg/filedlg95.c wine/winecvs/dlls/commdlg/filedlg95.c
--- CVS/wine/dlls/commdlg/filedlg95.c	Sun Mar 10 13:36:02 2002
+++ wine/winecvs/dlls/commdlg/filedlg95.c	Tue Mar 26 16:21:38 2002
@@ -1528,8 +1528,15 @@
 	    /* 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';
 	    }
 	  }
 	}







More information about the wine-patches mailing list