Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
859d5e68
Commit
859d5e68
authored
Sep 02, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Sep 04, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: Handle `if exist` with an empty string argument.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=55505
parent
61c5d2a0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
+15
-6
builtins.c
programs/cmd/builtins.c
+9
-6
test_builtins.cmd
programs/cmd/tests/test_builtins.cmd
+5
-0
test_builtins.cmd.exp
programs/cmd/tests/test_builtins.cmd.exp
+1
-0
No files found.
programs/cmd/builtins.c
View file @
859d5e68
...
...
@@ -2841,13 +2841,16 @@ int evaluate_if_condition(WCHAR *p, WCHAR **command, int *test, int *negate)
WCHAR
*
param
=
WCMD_parameter
(
p
,
1
+
(
*
negate
),
NULL
,
FALSE
,
FALSE
);
int
len
=
lstrlenW
(
param
);
if
(
!
len
)
goto
syntax_err
;
/* FindFirstFile does not like a directory path ending in '\' or '/', append a '.' */
if
(
param
[
len
-
1
]
==
'\\'
||
param
[
len
-
1
]
==
'/'
)
lstrcatW
(
param
,
L"."
);
if
(
!
len
)
{
*
test
=
FALSE
;
}
else
{
/* FindFirstFile does not like a directory path ending in '\' or '/', so append a '.' */
if
(
param
[
len
-
1
]
==
'\\'
||
param
[
len
-
1
]
==
'/'
)
wcscat
(
param
,
L"."
);
hff
=
FindFirstFileW
(
param
,
&
fd
);
*
test
=
(
hff
!=
INVALID_HANDLE_VALUE
);
if
(
*
test
)
FindClose
(
hff
);
hff
=
FindFirstFileW
(
param
,
&
fd
);
*
test
=
(
hff
!=
INVALID_HANDLE_VALUE
);
if
(
*
test
)
FindClose
(
hff
);
}
WCMD_parameter
(
p
,
2
+
(
*
negate
),
command
,
FALSE
,
FALSE
);
}
...
...
programs/cmd/tests/test_builtins.cmd
View file @
859d5e68
...
...
@@ -1176,6 +1176,11 @@ if exist "subdir/" (
) else (
echo ERROR exist subdir with / and quotes not working
)
if not exist "" (
echo exist empty string works
) else (
echo exist empty string broken
)
del foo subdir\bar
rd subdir
...
...
programs/cmd/tests/test_builtins.cmd.exp
View file @
859d5e68
...
...
@@ -833,6 +833,7 @@ exist subdir with \ and quotes ok
exist subdir with /. ok
exist subdir with / ok
exist subdir with / and quotes ok
exist empty string works
------ for numbers
negative numbers handled
negative numbers handled
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment