bug1564 - wcmd exists test

Ann and Jason Edmeades us at the-edmeades.demon.co.uk
Wed Jul 9 14:40:34 CDT 2003


wcmd 'Exist' used CreateFile to test for existance of a file bug failed
with dirs. A simpler test is GetFileAttributes and this handles dirs as
well. 

I have tested both positive and 'not' cases of:
	file
	dir
	absolute path to file
	absolute path to dir
	.
	..

Changelog:

Make batch if exists support directories

Jason
-------------- next part --------------
Index: programs/wcmd/builtins.c
===================================================================
RCS file: /home/wine/wine/programs/wcmd/builtins.c,v
retrieving revision 1.18
diff -u -r1.18 builtins.c
--- programs/wcmd/builtins.c	27 Feb 2003 01:41:21 -0000	1.18
+++ programs/wcmd/builtins.c	9 Jul 2003 19:31:17 -0000
@@ -395,11 +395,8 @@
     WCMD_parameter (p, 2+negate, &command);
   }
   else if (!lstrcmpi (condition, "exist")) {
-    if ((h = CreateFile (WCMD_parameter (p, 1+negate, NULL), GENERIC_READ,
-                         FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
-	OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) != INVALID_HANDLE_VALUE) {
-      CloseHandle (h);
-      test = 1;
+    if (GetFileAttributesA(WCMD_parameter (p, 1+negate, NULL)) != INVALID_FILE_ATTRIBUTES) {
+        test = 1;
     }
     WCMD_parameter (p, 2+negate, &command);
   }


More information about the wine-patches mailing list