Fixed notepad bug when creating a file on the command line
Modified: trunk/reactos/subsys/system/notepad/main.c

Modified: trunk/reactos/subsys/system/notepad/main.c
--- trunk/reactos/subsys/system/notepad/main.c	2005-10-28 00:54:31 UTC (rev 18821)
+++ trunk/reactos/subsys/system/notepad/main.c	2005-10-28 01:29:55 UTC (rev 18822)
@@ -450,10 +450,10 @@
             cmdline[lstrlen(cmdline) - 1] = 0;
         }
 
-        if (FileExists(cmdline))
+        file_name = cmdline;
+        if (FileExists(file_name))
         {
             file_exists = TRUE;
-            file_name = cmdline;
         }
         else if (!HasFileExtension(cmdline))
         {
@@ -469,13 +469,12 @@
                 lstrcpyn(buf, cmdline, MAX_PATH - lstrlen(txtW) - 1);
                 lstrcat(buf, txtW);
                 file_name = buf;
-                file_exists = FileExists(buf);
+                file_exists = FileExists(file_name);
             }
         }
 
         if (file_exists)
         {
-            file_name = cmdline;
             DoOpenFile(file_name);
             InvalidateRect(Globals.hMainWnd, NULL, FALSE);
             if (opt_print)