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
3d3c5ab4
Commit
3d3c5ab4
authored
Oct 30, 2014
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: Add a helper function to check if a path ends with a backslash.
parent
9c5f2312
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+10
-10
builtins.c
programs/cmd/builtins.c
+3
-3
directory.c
programs/cmd/directory.c
+2
-7
wcmd.h
programs/cmd/wcmd.h
+5
-0
No files found.
programs/cmd/builtins.c
View file @
3d3c5ab4
...
...
@@ -798,12 +798,12 @@ void WCMD_copy(WCHAR * args) {
/* If parameter is a directory, ensure it ends in \ */
attributes
=
GetFileAttributesW
(
destname
);
if
(
(
destname
[
strlenW
(
destname
)
-
1
]
==
'\\'
)
||
if
(
ends_with_backslash
(
destname
)
||
((
attributes
!=
INVALID_FILE_ATTRIBUTES
)
&&
(
attributes
&
FILE_ATTRIBUTE_DIRECTORY
)))
{
destisdirectory
=
TRUE
;
if
(
!
(
destname
[
strlenW
(
destname
)
-
1
]
==
'\\'
))
strcatW
(
destname
,
slashW
);
if
(
!
ends_with_backslash
(
destname
))
strcatW
(
destname
,
slashW
);
WINE_TRACE
(
"Directory, so full name is now '%s'
\n
"
,
wine_dbgstr_w
(
destname
));
}
}
...
...
@@ -880,7 +880,7 @@ void WCMD_copy(WCHAR * args) {
/* If parameter is a directory, ensure it ends in \* */
attributes
=
GetFileAttributesW
(
srcpath
);
if
(
srcpath
[
strlenW
(
srcpath
)
-
1
]
==
'\\'
)
{
if
(
ends_with_backslash
(
srcpath
)
)
{
/* We need to know where the filename part starts, so append * and
recalculate the full resulting path */
...
...
programs/cmd/directory.c
View file @
3d3c5ab4
...
...
@@ -833,13 +833,8 @@ void WCMD_directory (WCHAR *args)
if
((
strchrW
(
path
,
'*'
)
==
NULL
)
&&
(
strchrW
(
path
,
'%'
)
==
NULL
))
{
status
=
GetFileAttributesW
(
path
);
if
((
status
!=
INVALID_FILE_ATTRIBUTES
)
&&
(
status
&
FILE_ATTRIBUTE_DIRECTORY
))
{
if
(
path
[
strlenW
(
path
)
-
1
]
==
'\\'
)
{
strcatW
(
path
,
starW
);
}
else
{
static
const
WCHAR
slashStarW
[]
=
{
'\\'
,
'*'
,
'\0'
};
strcatW
(
path
,
slashStarW
);
}
if
(
!
ends_with_backslash
(
path
))
strcatW
(
path
,
slashW
);
strcatW
(
path
,
starW
);
}
}
else
{
/* Special case wildcard search with no extension (ie parameters ending in '.') as
...
...
programs/cmd/wcmd.h
View file @
3d3c5ab4
...
...
@@ -148,6 +148,11 @@ static inline WCHAR *heap_strdupW(const WCHAR *str)
return
ret
;
}
static
inline
BOOL
ends_with_backslash
(
const
WCHAR
*
path
)
{
return
path
[
0
]
&&
path
[
strlenW
(
path
)
-
1
]
==
'\\'
;
}
/* Data structure to hold context when executing batch files */
typedef
struct
_BATCH_CONTEXT
{
...
...
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