Make 'exist' in wcmd handle both file and directories.

This commit is contained in:
Jason Edmeades 2005-02-14 11:01:35 +00:00 committed by Alexandre Julliard
parent 5e161ac72a
commit c79342a11a

View file

@ -384,7 +384,6 @@ char string[MAX_PATH];
void WCMD_if (char *p) {
HANDLE h;
int negate = 0, test = 0;
char condition[MAX_PATH], *command, *s;
@ -401,10 +400,7 @@ char condition[MAX_PATH], *command, *s;
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);
if (GetFileAttributesA(WCMD_parameter (p, 1+negate, NULL)) != INVALID_FILE_ATTRIBUTES) {
test = 1;
}
WCMD_parameter (p, 2+negate, &command);