Commit 5acb82fc authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

shell32: Fix SHFileOperation(FO_MOVE) for a directory with subdirectories.

parent 5614ae23
...@@ -1389,42 +1389,13 @@ static DWORD delete_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom) ...@@ -1389,42 +1389,13 @@ static DWORD delete_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom)
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static void move_dir_to_dir(LPSHFILEOPSTRUCTW lpFileOp, const FILE_ENTRY *feFrom, LPCWSTR szDestPath)
{
WCHAR szFrom[MAX_PATH], szTo[MAX_PATH];
SHFILEOPSTRUCTW fileOp;
static const WCHAR wildCardFiles[] = {'*','.','*',0};
if (IsDotDir(feFrom->szFilename))
return;
SHNotifyCreateDirectoryW(szDestPath, NULL);
PathCombineW(szFrom, feFrom->szFullPath, wildCardFiles);
szFrom[lstrlenW(szFrom) + 1] = '\0';
lstrcpyW(szTo, szDestPath);
szTo[lstrlenW(szDestPath) + 1] = '\0';
fileOp = *lpFileOp;
fileOp.pFrom = szFrom;
fileOp.pTo = szTo;
SHFileOperationW(&fileOp);
}
/* moves a file or directory to another directory */ /* moves a file or directory to another directory */
static void move_to_dir(LPSHFILEOPSTRUCTW lpFileOp, const FILE_ENTRY *feFrom, const FILE_ENTRY *feTo) static void move_to_dir(LPSHFILEOPSTRUCTW lpFileOp, const FILE_ENTRY *feFrom, const FILE_ENTRY *feTo)
{ {
WCHAR szDestPath[MAX_PATH]; WCHAR szDestPath[MAX_PATH];
PathCombineW(szDestPath, feTo->szFullPath, feFrom->szFilename); PathCombineW(szDestPath, feTo->szFullPath, feFrom->szFilename);
SHNotifyMoveFileW(feFrom->szFullPath, szDestPath);
if (IsAttribFile(feFrom->attributes))
SHNotifyMoveFileW(feFrom->szFullPath, szDestPath);
else if (!(lpFileOp->fFlags & FOF_FILESONLY && feFrom->bFromWildcard))
move_dir_to_dir(lpFileOp, feFrom, szDestPath);
} }
/* the FO_MOVE operation */ /* the FO_MOVE operation */
......
...@@ -1860,7 +1860,6 @@ static void test_move(void) ...@@ -1860,7 +1860,6 @@ static void test_move(void)
ok(file_exists("testdir2"), "dir should not be moved\n"); ok(file_exists("testdir2"), "dir should not be moved\n");
ok(!file_exists("testdir2\\one.txt"), "file should be moved\n"); ok(!file_exists("testdir2\\one.txt"), "file should be moved\n");
todo_wine
ok(!file_exists("testdir2\\nested"), "dir should be moved\n"); ok(!file_exists("testdir2\\nested"), "dir should be moved\n");
ok(!file_exists("testdir2\\nested\\two.txt"), "file should be moved\n"); ok(!file_exists("testdir2\\nested\\two.txt"), "file should be moved\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment