mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-21 17:09:06 -07:00
cmd: Fix 'IF EXIST DIRECTORY' test condition evaluation.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
parent
f21744527e
commit
d254d4ce12
Notes:
Alexandre Julliard
2024-11-12 22:01:42 +01:00
Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6803
2 changed files with 9 additions and 9 deletions
|
@ -1088,9 +1088,9 @@ exist subdir with /. ok
|
|||
exist subdir with / ok
|
||||
exist subdir with / and quotes ok
|
||||
exist empty string works
|
||||
@todo_wine@ok
|
||||
@todo_wine@ok
|
||||
@todo_wine@ok
|
||||
ok
|
||||
ok
|
||||
ok
|
||||
------ for numbers
|
||||
negative numbers handled
|
||||
negative numbers handled
|
||||
|
|
|
@ -3196,14 +3196,14 @@ static BOOL if_condition_evaluate(CMD_IF_CONDITION *cond, int *test)
|
|||
handleExpansion(expanded_left, TRUE);
|
||||
if ((len = wcslen(expanded_left)))
|
||||
{
|
||||
/* FindFirstFile does not like a directory path ending in '\' or '/', so append a '.' */
|
||||
if ((expanded_left[len - 1] == '\\' || expanded_left[len - 1] == '/') && len < MAXSTRING - 1)
|
||||
if (!wcspbrk(expanded_left, L"*?"))
|
||||
*test = GetFileAttributesW(expanded_left) != INVALID_FILE_ATTRIBUTES;
|
||||
else
|
||||
{
|
||||
wcscat(expanded_left, L".");
|
||||
hff = FindFirstFileW(expanded_left, &fd);
|
||||
*test = (hff != INVALID_HANDLE_VALUE);
|
||||
if (*test) FindClose(hff);
|
||||
}
|
||||
hff = FindFirstFileW(expanded_left, &fd);
|
||||
*test = (hff != INVALID_HANDLE_VALUE);
|
||||
if (*test) FindClose(hff);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue