Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
8e575940
Commit
8e575940
authored
Oct 25, 2012
by
Jason Edmeades
Committed by
Alexandre Julliard
Nov 06, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attrib: Support relative paths as args.
parent
7c3f3d09
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
attrib.c
programs/attrib/attrib.c
+14
-5
test_builtins.cmd.exp
programs/cmd/tests/test_builtins.cmd.exp
+2
-2
No files found.
programs/attrib/attrib.c
View file @
8e575940
...
...
@@ -129,11 +129,11 @@ int wmain(int argc, WCHAR *argv[])
WIN32_FIND_DATAW
fd
;
WCHAR
flags
[]
=
{
' '
,
' '
,
' '
,
' '
,
' '
,
' '
,
' '
,
' '
,
'\0'
};
WCHAR
name
[
MAX_PATH
];
WCHAR
*
namepart
;
WCHAR
curdir
[
MAX_PATH
];
DWORD
attrib_set
=
0
;
DWORD
attrib_clear
=
0
;
const
WCHAR
help_option
[]
=
{
'/'
,
'?'
,
'\0'
};
const
WCHAR
slash
[]
=
{
'\\'
,
'\0'
};
const
WCHAR
start
[]
=
{
'*'
,
'\0'
};
int
i
=
1
;
...
...
@@ -143,13 +143,11 @@ int wmain(int argc, WCHAR *argv[])
}
/* By default all files from current directory are taken into account */
GetCurrentDirectoryW
(
sizeof
(
curdir
)
/
sizeof
(
WCHAR
),
curdir
);
strcatW
(
curdir
,
slash
);
strcpyW
(
name
,
curdir
);
strcatW
(
name
,
start
);
strcpyW
(
name
,
start
);
while
(
i
<
argc
)
{
WCHAR
*
param
=
argv
[
i
++
];
WINE_TRACE
(
"Processing arg: '%s'
\n
"
,
wine_dbgstr_w
(
param
));
if
((
param
[
0
]
==
'+'
)
||
(
param
[
0
]
==
'-'
))
{
DWORD
attrib
=
0
;
switch
(
param
[
1
])
{
...
...
@@ -178,6 +176,15 @@ int wmain(int argc, WCHAR *argv[])
}
}
/* Name may be a relative or explicit path, so calculate curdir based on
current locations, stripping off the filename */
WINE_TRACE
(
"Supplied name: '%s'
\n
"
,
wine_dbgstr_w
(
name
));
GetFullPathNameW
(
name
,
sizeof
(
curdir
)
/
sizeof
(
WCHAR
),
curdir
,
&
namepart
);
WINE_TRACE
(
"Result: '%s'
\n
"
,
wine_dbgstr_w
(
curdir
));
strcpyW
(
name
,
curdir
);
if
(
namepart
)
*
namepart
=
0x00
;
/* Search for files based on the location and filespec supplied */
hff
=
FindFirstFileW
(
name
,
&
fd
);
if
(
hff
==
INVALID_HANDLE_VALUE
)
{
ATTRIB_wprintf
(
ATTRIB_LoadMessage
(
STRING_FILENOTFOUND
),
name
);
...
...
@@ -195,6 +202,8 @@ int wmain(int argc, WCHAR *argv[])
fd
.
dwFileAttributes
|=
attrib_set
;
if
(
!
fd
.
dwFileAttributes
)
fd
.
dwFileAttributes
|=
FILE_ATTRIBUTE_NORMAL
;
strcpyW
(
name
,
curdir
);
strcatW
(
name
,
fd
.
cFileName
);
SetFileAttributesW
(
name
,
fd
.
dwFileAttributes
);
}
else
{
static
const
WCHAR
fmt
[]
=
{
'%'
,
'1'
,
' '
,
' '
,
' '
,
' '
,
' '
,
'%'
,
'2'
,
'\n'
,
'\0'
};
...
...
programs/cmd/tests/test_builtins.cmd.exp
View file @
8e575940
...
...
@@ -959,14 +959,14 @@ foo original contents
Read-only file not deleted
Read-only file forcibly deleted
--- recursive behaviour
@todo_wine@
A @pwd@\foobar\baz\level2@or_broken@A @pwd@\foobar\baz\level2@or_broken@A I @pwd@\foobar\baz\level2
A @pwd@\foobar\baz\level2@or_broken@A @pwd@\foobar\baz\level2@or_broken@A I @pwd@\foobar\baz\level2
@todo_wine@A R @pwd@\foobar\level1@or_broken@A R @pwd@\foobar\level1@or_broken@A R I @pwd@\foobar\level1
@todo_wine@A R @pwd@\foobar\baz\level2@or_broken@A R @pwd@\foobar\baz\level2@or_broken@A R I @pwd@\foobar\baz\level2
A @pwd@\foobar\bar@or_broken@A @pwd@\foobar\bar@or_broken@A I @pwd@\foobar\bar
--- folders processing
@pwd@\foobar@or_broken@ @pwd@\foobar@or_broken@ I @pwd@\foobar
@todo_wine@ R @pwd@\foobar\baz@or_broken@ R @pwd@\foobar\baz@or_broken@ @pwd@\foobar\baz@or_broken@ R I @pwd@\foobar\baz
@todo_wine@
A @pwd@\foobar\baz\toto@or_broken@A @pwd@\foobar\baz\toto@or_broken@A I @pwd@\foobar\baz\toto
A @pwd@\foobar\baz\toto@or_broken@A @pwd@\foobar\baz\toto@or_broken@A I @pwd@\foobar\baz\toto
toto
lulu
file created in read-only dir
...
...
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