Implement second part of move folder. Now we can move empty folder. we need add code for move folder with contain now.

svn path=/trunk/; revision=17907
This commit is contained in:
Magnus Olsen 2005-09-18 09:29:37 +00:00
parent 989e287e31
commit 42acc38f81

View file

@ -314,6 +314,7 @@ MoveFileWithProgressW (
NTSTATUS errCode; NTSTATUS errCode;
BOOL Result; BOOL Result;
UNICODE_STRING DstPathU; UNICODE_STRING DstPathU;
BOOL folder = FALSE;
DPRINT("MoveFileWithProgressW()\n"); DPRINT("MoveFileWithProgressW()\n");
@ -325,12 +326,24 @@ MoveFileWithProgressW (
FILE_SHARE_WRITE|FILE_SHARE_READ, FILE_SHARE_WRITE|FILE_SHARE_READ,
NULL, NULL,
OPEN_EXISTING, OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS, FILE_ATTRIBUTE_NORMAL,
NULL); NULL);
if (hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)
{ {
hFile = CreateFileW (lpExistingFileName,
GENERIC_ALL,
FILE_SHARE_WRITE|FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
NULL);
if (hFile == INVALID_HANDLE_VALUE)
return FALSE; return FALSE;
folder = TRUE;
} }
/* validate & translate the filename */ /* validate & translate the filename */
@ -373,12 +386,14 @@ MoveFileWithProgressW (
* Before we fail at CreateFileW * Before we fail at CreateFileW
*/ */
if (NT_SUCCESS(errCode)) if (NT_SUCCESS(errCode))
{ {
Result = TRUE; Result = TRUE;
} }
else if (STATUS_NOT_SAME_DEVICE == errCode && else if (STATUS_NOT_IMPLEMENTED == errCode)
MOVEFILE_COPY_ALLOWED == (dwFlags & MOVEFILE_COPY_ALLOWED)) {
if (folder==FALSE)
{ {
Result = CopyFileExW (lpExistingFileName, Result = CopyFileExW (lpExistingFileName,
lpNewFileName, lpNewFileName,
@ -393,6 +408,19 @@ MoveFileWithProgressW (
Result = DeleteFileW (lpExistingFileName); Result = DeleteFileW (lpExistingFileName);
} }
} }
else
{
/* move folder not complete code */
Result = CreateDirectoryW (lpNewFileName, NULL);
if (Result == FALSE) return FALSE;
/* add scan code for move the folder */
AdjustFileAttributes(lpExistingFileName, lpNewFileName);
Result = RemoveDirectoryW(lpExistingFileName);
}
}
#if 1 #if 1
/* FIXME file rename not yet implemented in all FSDs so it will always /* FIXME file rename not yet implemented in all FSDs so it will always
* fail, even when the move is to the same device * fail, even when the move is to the same device
@ -445,7 +473,7 @@ MoveFileWithProgressW (
else else
{ {
SetLastErrorByStatus (errCode); SetLastErrorByStatus (errCode);
Result = FALSE; Result = TRUE;
} }
return Result; return Result;
} }