From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- programs/cmd/tests/test_builtins.cmd.exp | 6 +++--- programs/cmd/wcmdmain.c | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp index 2fdb5fa256d..3c516b79fe5 100644 --- a/programs/cmd/tests/test_builtins.cmd.exp +++ b/programs/cmd/tests/test_builtins.cmd.exp @@ -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 diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 466df207f12..1018fd56624 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -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;