cmd: Make RENAME work for read-only files.

oldstable
Frédéric Delanoy 2011-10-14 15:37:59 +02:00 committed by Alexandre Julliard
parent d5523fcd80
commit 6fd9d77426
2 changed files with 4 additions and 13 deletions

View File

@ -1768,8 +1768,8 @@ void WCMD_remove_dir (WCHAR *command) {
* Rename a file.
*/
void WCMD_rename (void) {
void WCMD_rename (void)
{
int status;
HANDLE hff;
WIN32_FIND_DATAW fd;
@ -1779,7 +1779,6 @@ void WCMD_rename (void) {
WCHAR dir[MAX_PATH];
WCHAR fname[MAX_PATH];
WCHAR ext[MAX_PATH];
DWORD attribs;
errorlevel = 0;
@ -1853,15 +1852,7 @@ void WCMD_rename (void) {
WINE_TRACE("Source '%s'\n", wine_dbgstr_w(src));
WINE_TRACE("Dest '%s'\n", wine_dbgstr_w(dest));
/* Check if file is read only, otherwise move it */
attribs = GetFileAttributesW(src);
if ((attribs != INVALID_FILE_ATTRIBUTES) &&
(attribs & FILE_ATTRIBUTE_READONLY)) {
SetLastError(ERROR_ACCESS_DENIED);
status = 0;
} else {
status = MoveFileW(src, dest);
}
status = MoveFileW(src, dest);
if (!status) {
WCMD_print_error ();

View File

@ -602,7 +602,7 @@ bar renamed to foo
foo
bar
... rename read-only files ...
@todo_wine@read-only file renamed
read-only file renamed
... rename directories ...
dir renamed
read-only dir renamed