From 9435f3ce1574bd11f279d5be384eb7760e40eba5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mariusz=20Pluci=C5=84ski?= Date: Tue, 5 Jul 2011 11:07:30 +0200 Subject: [PATCH] shell32: Add support of KF_REDIRECT_DEL_SOURCE_CONTENTS flag to redirection. --- dlls/shell32/shellpath.c | 20 +++++++++++++++++++- dlls/shell32/tests/shellpath.c | 1 - 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index b5209a69041..58e20060289 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -3232,12 +3232,30 @@ static HRESULT redirect_known_folder( lstrcpyW(dstPath, pszTargetPath); ZeroMemory(&fileOp, sizeof(fileOp)); - fileOp.wFunc = FO_COPY; + + if(flags & KF_REDIRECT_DEL_SOURCE_CONTENTS) + fileOp.wFunc = FO_MOVE; + else + fileOp.wFunc = FO_COPY; + fileOp.pFrom = srcPath; fileOp.pTo = dstPath; fileOp.fFlags = FOF_NO_UI; hr = (SHFileOperationW(&fileOp)==0 ? S_OK : E_FAIL); + + if(flags & KF_REDIRECT_DEL_SOURCE_CONTENTS) + { + ZeroMemory(srcPath, sizeof(srcPath)); + lstrcpyW(srcPath, lpSrcPath); + + ZeroMemory(&fileOp, sizeof(fileOp)); + fileOp.wFunc = FO_DELETE; + fileOp.pFrom = srcPath; + fileOp.fFlags = FOF_NO_UI; + + hr = (SHFileOperationW(&fileOp)==0 ? S_OK : E_FAIL); + } } CoTaskMemFree(lpSrcPath); diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c index 0be43f43597..3a3c59728b3 100644 --- a/dlls/shell32/tests/shellpath.c +++ b/dlls/shell32/tests/shellpath.c @@ -1397,7 +1397,6 @@ static void test_knownFolders(void) /* check if original directory was really removed */ dwAttributes = GetFileAttributesW(sExamplePath); - todo_wine ok(dwAttributes==INVALID_FILE_ATTRIBUTES, "directory should not exist, but has attributes: 0x%08x\n", dwAttributes ); -- 2.11.4.GIT