Module: wine Branch: master Commit: c8fcedcf260c93cd8ffb1bcc9e96802e97972e5e URL: https://source.winehq.org/git/wine.git/?a=commit;h=c8fcedcf260c93cd8ffb1bcc9...
Author: Jason Edmeades us@edmeades.me.uk Date: Sun Jun 24 21:44:14 2018 +0100
xcopy: Fix copying empty directories.
Signed-off-by: Jason Edmeades us@edmeades.me.uk Signed-off-by: Alexandre Julliard julliard@winehq.org
---
programs/xcopy/tests/xcopy.c | 1 - programs/xcopy/xcopy.c | 13 +++++++------ 2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/programs/xcopy/tests/xcopy.c b/programs/xcopy/tests/xcopy.c index 0991d49..94cede6 100644 --- a/programs/xcopy/tests/xcopy.c +++ b/programs/xcopy/tests/xcopy.c @@ -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"); diff --git a/programs/xcopy/xcopy.c b/programs/xcopy/xcopy.c index 97b0538..e380cde 100644 --- a/programs/xcopy/xcopy.c +++ b/programs/xcopy/xcopy.c @@ -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); }