mirror of
https://github.com/reactos/reactos.git
synced 2026-05-23 07:40:09 +08:00
committed by
GitHub
parent
2b067d6494
commit
4e263367f8
@@ -118,6 +118,7 @@ INT ExecuteIf(PARSED_COMMAND *Cmd)
|
||||
INT Size;
|
||||
WIN32_FIND_DATA f;
|
||||
HANDLE hFind;
|
||||
DWORD attrs;
|
||||
|
||||
/* IF EXIST filename: check if file exists (wildcards allowed) */
|
||||
StripQuotes(Right);
|
||||
@@ -127,20 +128,24 @@ INT ExecuteIf(PARSED_COMMAND *Cmd)
|
||||
if (IsDir)
|
||||
Right[Size - 1] = 0;
|
||||
|
||||
|
||||
hFind = FindFirstFile(Right, &f);
|
||||
if (hFind != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
if (IsDir)
|
||||
{
|
||||
result = ((f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = TRUE;
|
||||
}
|
||||
attrs = f.dwFileAttributes;
|
||||
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)
|
||||
Right[Size - 1] = '\\';
|
||||
|
||||
Reference in New Issue
Block a user