From d5ae40868cce47e9bd7c09d0398ea5bb22542057 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Fri, 22 Jul 2005 23:58:26 +0000 Subject: [PATCH] last mins bug fix frirc nick jjkola, Jyrki Jaakkola for move. solve some new bugs. I forget menoter multuser is not done yet. But move folder from a vol to another works. Move need really clean up after his patch. svn path=/trunk/; revision=16696 --- reactos/subsys/system/cmd/move.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/reactos/subsys/system/cmd/move.c b/reactos/subsys/system/cmd/move.c index 567287df898..ac50741ea3e 100644 --- a/reactos/subsys/system/cmd/move.c +++ b/reactos/subsys/system/cmd/move.c @@ -64,13 +64,13 @@ static INT Overwrite (LPTSTR fn) return res; } -void GetDirectory (LPTSTR wholepath, LPTSTR directory) +void GetDirectory (LPTSTR wholepath, LPTSTR directory, BOOL CheckExisting) { /* returns only directory part of path with backslash */ /* TODO: make code unc aware */ /* Is there a better alternative to this? */ LPTSTR last; - if (IsExistingDirectory(wholepath)) + if (CheckExisting && IsExistingDirectory(wholepath)) { _tcscpy(directory, wholepath); } @@ -196,7 +196,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param) #endif /* get source folder */ - GetDirectory(arg[argc - 2], szSrcDirPath); + GetDirectory(arg[argc - 2], szSrcDirPath, 1); GetFullPathName(szSrcDirPath, MAX_PATH, szSrcPath, &pszFile); _tcscpy(szSrcDirPath,szSrcPath); /* we need following check to see if source happens to be directly given directory @@ -464,6 +464,7 @@ INT cmd_move (LPTSTR cmd, LPTSTR param) (pszSrcDirPointer)--; (pszDestDirPointer)--; _tcscpy(pszSrcDirPointer,_T("")); + _tcscpy(pszDestDirPointer,_T("")); if (nDirLevel > 0) { TCHAR szTempPath[MAX_PATH]; @@ -472,10 +473,12 @@ INT cmd_move (LPTSTR cmd, LPTSTR param) FoundFile = TRUE; /* we need to continue our seek for files */ nDirLevel--; RemoveDirectory(szMoveSrc); - GetDirectory(szMoveSrc,szTempPath); + GetDirectory(szMoveSrc,szTempPath,0); nDiff = _tcslen(szMoveSrc) - _tcslen(szTempPath); pszSrcDirPointer = pszSrcDirPointer - nDiff; _tcscpy(pszSrcDirPointer,_T("")); + GetDirectory(szMoveDest,szTempPath,0); + nDiff = _tcslen(szMoveDest) - _tcslen(szTempPath); pszDestDirPointer = pszDestDirPointer - nDiff; _tcscpy(pszDestDirPointer,_T("")); if(szMoveSrc[_tcslen(szMoveSrc) - 1] != _T('\\')) @@ -485,7 +488,6 @@ INT cmd_move (LPTSTR cmd, LPTSTR param) pszDestDirPointer = szMoveDest + _tcslen(szMoveDest); pszSrcDirPointer = szMoveSrc + _tcslen(szMoveSrc); _tcscpy(pszSrcDirPointer,_T("*.*")); - _tcscpy(pszDestDirPointer,_T("*.*")); hDestFile = FindFirstFile(szMoveSrc, &findDestBuffer); if (hDestFile == INVALID_HANDLE_VALUE) continue; @@ -522,7 +524,6 @@ INT cmd_move (LPTSTR cmd, LPTSTR param) pszDestDirPointer = szMoveDest + _tcslen(szMoveDest); pszSrcDirPointer = szMoveSrc + _tcslen(szMoveSrc); _tcscpy(pszSrcDirPointer,_T("*.*")); - _tcscpy(pszDestDirPointer,_T("*.*")); hDestFile = FindFirstFile(szMoveSrc, &findDestBuffer); if (hDestFile == INVALID_HANDLE_VALUE) {