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
f53d57c8
Commit
f53d57c8
authored
Jun 24, 2018
by
Jason Edmeades
Committed by
Alexandre Julliard
Jun 25, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: Add support for wildcards in if exist.
Signed-off-by:
Jason Edmeades
<
us@edmeades.me.uk
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
46c5eb17
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
2 deletions
+56
-2
builtins.c
programs/cmd/builtins.c
+5
-2
test_builtins.cmd
programs/cmd/tests/test_builtins.cmd
+43
-0
test_builtins.cmd.exp
programs/cmd/tests/test_builtins.cmd.exp
+8
-0
No files found.
programs/cmd/builtins.c
View file @
f53d57c8
...
...
@@ -2804,8 +2804,11 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList)
WCMD_parameter
(
p
,
2
+
negate
,
&
command
,
FALSE
,
FALSE
);
}
else
if
(
!
lstrcmpiW
(
condition
,
existW
))
{
test
=
(
GetFileAttributesW
(
WCMD_parameter
(
p
,
1
+
negate
,
NULL
,
FALSE
,
FALSE
))
!=
INVALID_FILE_ATTRIBUTES
);
WIN32_FIND_DATAW
fd
;
HANDLE
hff
=
FindFirstFileW
(
WCMD_parameter
(
p
,
1
+
negate
,
NULL
,
FALSE
,
FALSE
),
&
fd
);
test
=
(
hff
!=
INVALID_HANDLE_VALUE
);
if
(
!
test
)
FindClose
(
hff
);
WCMD_parameter
(
p
,
2
+
negate
,
&
command
,
FALSE
,
FALSE
);
}
else
if
(
!
lstrcmpiW
(
condition
,
defdW
))
{
...
...
programs/cmd/tests/test_builtins.cmd
View file @
f53d57c8
...
...
@@ -979,6 +979,49 @@ for %%i in (%WINE_STR_PARMS%) do (
for %%i in (%WINE_STR_PARMS%) do (
for %%j in (%WINE_STR_PARMS%) do (
call :GTRtest %%i %%j))
echo ------------ Testing if/exist ------------
mkdir subdir
echo something>subdir\bar
echo something else>foo
if exist foo (
echo exist explicit works
) else (
echo ERROR exist explicit broken
)
if exist bar (
echo ERROR exist explicit unknown file broken
) else (
echo exist explicit unknown file works
)
if exist subdir\bar (
echo exist explicit in subdir works
) else (
echo ERROR exist explicit in subdir broken
)
if exist fo* (
echo exist simple wildcard works
) else (
echo ERROR exist simple wildcard broken
)
if exist subdir\ba* (
echo exist wildcard works
) else (
echo ERROR exist wildcard broken
)
if not exist subdir\ba* (
echo ERROR negate exist wildcard broken
) else (
echo negate exist wildcard works
)
if exist idontexist\ba* (
echo ERROR exist wildcard bad subdir broken
) else (
echo exist wildcard bad subdir broken works
)
del foo subdir\bar
rd subdir
echo ------ for numbers
if -1 LSS 1 (echo negative numbers handled)
if not -1 LSS -10 (echo negative numbers handled)
...
...
programs/cmd/tests/test_builtins.cmd.exp
View file @
f53d57c8
...
...
@@ -768,6 +768,14 @@ BA GTR B
BA GTR AB
BA GTR AA
AA GTR A
------------ Testing if/exist ------------
exist explicit works
exist explicit unknown file works
exist explicit in subdir works
exist simple wildcard works
exist wildcard works
negate exist wildcard works
exist wildcard bad subdir broken 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