Author: jmorlan
Date: Mon Jul 13 22:55:33 2009
New Revision: 41942
URL:
http://svn.reactos.org/svn/reactos?rev=41942&view=rev
Log:
Make IF EXIST directory\ (with trailing backslash) work
Modified:
trunk/reactos/base/shell/cmd/if.c
Modified: trunk/reactos/base/shell/cmd/if.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/if.c?rev=41…
==============================================================================
--- trunk/reactos/base/shell/cmd/if.c [iso-8859-1] (original)
+++ trunk/reactos/base/shell/cmd/if.c [iso-8859-1] Mon Jul 13 22:55:33 2009
@@ -115,16 +115,21 @@
else if (Cmd->If.Operator == IF_EXIST)
{
/* IF EXIST filename: check if file exists (wildcards allowed) */
- WIN32_FIND_DATA f;
- HANDLE hFind;
-
StripQuotes(Right);
- hFind = FindFirstFile(Right, &f);
- if (hFind != INVALID_HANDLE_VALUE)
+ if (_tcschr(Right, _T('*')) || _tcschr(Right, _T('?')))
{
- result = TRUE;
- FindClose(hFind);
+ WIN32_FIND_DATA f;
+ HANDLE hFind = FindFirstFile(Right, &f);
+ if (hFind != INVALID_HANDLE_VALUE)
+ {
+ result = TRUE;
+ FindClose(hFind);
+ }
+ }
+ else
+ {
+ result = (GetFileAttributes(Right) != INVALID_FILE_ATTRIBUTES);
}
}
else