xcopy: Fix copying empty directories.

Signed-off-by: Jason Edmeades <us@edmeades.me.uk>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Jason Edmeades 2018-06-24 21:44:14 +01:00 committed by Alexandre Julliard
parent 8a84148e52
commit c8fcedcf26
2 changed files with 7 additions and 7 deletions

View File

@ -103,7 +103,6 @@ static void test_parms_syntax(void)
rc = runcmd("xcopy /D/S/E xcopytest xcopytest2\\");
ok(rc == 0, "xcopy /D/S/E test failed rc=%u\n", rc);
todo_wine
ok(GetFileAttributesA("xcopytest2") != INVALID_FILE_ATTRIBUTES,
"xcopy failed to copy empty directory\n");
RemoveDirectoryA("xcopytest2");

View File

@ -590,6 +590,13 @@ static int XCOPY_DoCopy(WCHAR *srcstem, WCHAR *srcspec,
/* Search 2 - do subdirs */
if (flags & OPT_RECURSIVE) {
/* If /E is supplied, create the directory now */
if ((flags & OPT_EMPTYDIR) &&
!(flags & OPT_SIMULATE)) {
XCOPY_CreateDirectory(deststem);
}
lstrcpyW(inputpath, srcstem);
lstrcatW(inputpath, wchr_star);
findres = TRUE;
@ -613,12 +620,6 @@ static int XCOPY_DoCopy(WCHAR *srcstem, WCHAR *srcspec,
lstrcpyW(outputpath, deststem);
if (*destspec == 0x00) {
lstrcatW(outputpath, finddata->cFileName);
/* If /E is supplied, create the directory now */
if ((flags & OPT_EMPTYDIR) &&
!(flags & OPT_SIMULATE))
XCOPY_CreateDirectory(outputpath);
lstrcatW(outputpath, wchr_slash);
}