mirror of
https://github.com/reactos/reactos.git
synced 2025-06-01 15:38:37 +00:00
parent
2b067d6494
commit
4e263367f8
1 changed files with 14 additions and 9 deletions
|
@ -118,6 +118,7 @@ INT ExecuteIf(PARSED_COMMAND *Cmd)
|
||||||
INT Size;
|
INT Size;
|
||||||
WIN32_FIND_DATA f;
|
WIN32_FIND_DATA f;
|
||||||
HANDLE hFind;
|
HANDLE hFind;
|
||||||
|
DWORD attrs;
|
||||||
|
|
||||||
/* IF EXIST filename: check if file exists (wildcards allowed) */
|
/* IF EXIST filename: check if file exists (wildcards allowed) */
|
||||||
StripQuotes(Right);
|
StripQuotes(Right);
|
||||||
|
@ -127,20 +128,24 @@ INT ExecuteIf(PARSED_COMMAND *Cmd)
|
||||||
if (IsDir)
|
if (IsDir)
|
||||||
Right[Size - 1] = 0;
|
Right[Size - 1] = 0;
|
||||||
|
|
||||||
|
|
||||||
hFind = FindFirstFile(Right, &f);
|
hFind = FindFirstFile(Right, &f);
|
||||||
if (hFind != INVALID_HANDLE_VALUE)
|
if (hFind != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
if (IsDir)
|
attrs = f.dwFileAttributes;
|
||||||
{
|
|
||||||
result = ((f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = TRUE;
|
|
||||||
}
|
|
||||||
FindClose(hFind);
|
FindClose(hFind);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* FindFirstFile fails at the root directory. */
|
||||||
|
attrs = GetFileAttributes(Right);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attrs == 0xFFFFFFFF)
|
||||||
|
result = FALSE;
|
||||||
|
else if (IsDir)
|
||||||
|
result = ((attrs & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY);
|
||||||
|
else
|
||||||
|
result = TRUE;
|
||||||
|
|
||||||
if (IsDir)
|
if (IsDir)
|
||||||
Right[Size - 1] = '\\';
|
Right[Size - 1] = '\\';
|
||||||
|
|
Loading…
Reference in a new issue