notepad: notepad passes OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST to GetOpenFileName, so there is no point in testing file existence

Dmitry Timoshkov dmitry at codeweavers.com
Fri Aug 31 02:02:01 CDT 2007


Hello,

Changelog:
    notepad: notepad passes OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST to
    GetOpenFileName, so there is no point in testing file existence.

---
 programs/notepad/dialog.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/programs/notepad/dialog.c b/programs/notepad/dialog.c
index 0a62c5e..c21c2d7 100644
--- a/programs/notepad/dialog.c
+++ b/programs/notepad/dialog.c
@@ -217,7 +217,7 @@ void DoOpenFile(LPCWSTR szFileName)
 	OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
     if(hFile == INVALID_HANDLE_VALUE)
     {
-	ShowLastError();
+	AlertFileNotFound(szFileName);
 	return;
     }
 
@@ -318,12 +318,8 @@ VOID DIALOG_FileOpen(VOID)
     openfilename.lpstrDefExt       = szDefaultExt;
 
 
-    if (GetOpenFileName(&openfilename)) {
-        if (FileExists(openfilename.lpstrFile))
-            DoOpenFile(openfilename.lpstrFile);
-        else
-            AlertFileNotFound(openfilename.lpstrFile);
-    }
+    if (GetOpenFileName(&openfilename))
+        DoOpenFile(openfilename.lpstrFile);
 }
 
 
-- 
1.5.2.5






More information about the wine-patches mailing list