[CMD] copy command:

- Don't pass device path to FindFirstFile, use short path instead
- Join duplicate code to simplify processing
See issue #3575 for more details.

svn path=/trunk/; revision=47418
This commit is contained in:
Gregor Schneider 2010-05-29 16:49:23 +00:00
parent 04c946cecc
commit 08ca572fc4

View file

@ -604,28 +604,30 @@ INT cmd_copy (LPTSTR param)
bTouch = TRUE;
bDone = TRUE;
}
if(_tcslen(tmpName) == 2)
{
if(tmpName[1] == _T(':'))
{
GetRootPath(tmpName,szSrcPath,MAX_PATH);
}
}
else
/* Get the full path to first file in the string of file names */
GetFullPathName (tmpName, MAX_PATH, szSrcPath, NULL);
}
else
{
bDone = TRUE;
if(_tcslen(arg[nSrc]) == 2 && arg[nSrc][1] == _T(':'))
_tcscpy(tmpName, arg[nSrc]);
}
/* Get full path or root names */
if(_tcslen(tmpName) == 2 && tmpName[1] == _T(':'))
{
GetRootPath(tmpName,szSrcPath,MAX_PATH);
}
else
{
/* Get the full path to first file in the string of file names */
GetFullPathName (tmpName, MAX_PATH, szSrcPath, NULL);
/* We got a device path of form \\.\x */
/* FindFirstFile cannot handle this, therefore use the short path */
if (szSrcPath[0] == _T('\\') && szSrcPath[1] == _T('\\') &&
szSrcPath[2] == _T('.') && szSrcPath[3] == _T('\\'))
{
GetRootPath(arg[nSrc],szSrcPath,MAX_PATH);
_tcscpy(szSrcPath, tmpName);
}
else
/* Get the full path of the source file */
GetFullPathName (arg[nSrc], MAX_PATH, szSrcPath, NULL);
}
/* From this point on, we can assume that the shortest path is 3 letters long