mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
Víctor Martínez Calvo <vicmarcal AT hotmail DOT com>
- Fix dir command behavior for files without extension. - See issue #3968 for more details. svn path=/trunk/; revision=38746
This commit is contained in:
parent
0c4b617c16
commit
2b06cfc0ef
1 changed files with 55 additions and 45 deletions
|
@ -1517,20 +1517,21 @@ static INT
|
||||||
DirList(LPTSTR szPath, /* [IN] The path that dir starts */
|
DirList(LPTSTR szPath, /* [IN] The path that dir starts */
|
||||||
LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags of the listing */
|
LPDIRSWITCHFLAGS lpFlags) /* [IN] The flags of the listing */
|
||||||
{
|
{
|
||||||
|
BOOL fPoint; /* If szPath is a file with extension fPoint will be True*/
|
||||||
HANDLE hSearch; /* The handle of the search */
|
HANDLE hSearch; /* The handle of the search */
|
||||||
HANDLE hRecSearch; /* The handle for searching recursivly */
|
HANDLE hRecSearch; /* The handle for searching recursivly */
|
||||||
WIN32_FIND_DATA wfdFileInfo; /* The info of file that found */
|
WIN32_FIND_DATA wfdFileInfo; /* The info of file that found */
|
||||||
LPWIN32_FIND_DATA * ptrFileArray; /* An array of pointers with all the files */
|
LPWIN32_FIND_DATA * ptrFileArray; /* An array of pointers with all the files */
|
||||||
PDIRFINDLISTNODE ptrStartNode; /* The pointer to the first node */
|
PDIRFINDLISTNODE ptrStartNode; /* The pointer to the first node */
|
||||||
PDIRFINDLISTNODE ptrNextNode; /* A pointer used for relatives refernces */
|
PDIRFINDLISTNODE ptrNextNode; /* A pointer used for relatives refernces */
|
||||||
TCHAR szFullPath[MAX_PATH]; /* The full path that we are listing with trailing \ */
|
TCHAR szFullPath[MAX_PATH]; /* The full path that we are listing with trailing \ */
|
||||||
TCHAR szSubPath[MAX_PATH];
|
TCHAR szSubPath[MAX_PATH];
|
||||||
LPTSTR pszFilePart;
|
LPTSTR pszFilePart;
|
||||||
DWORD dwCount; /* A counter of files found in directory */
|
DWORD dwCount; /* A counter of files found in directory */
|
||||||
DWORD dwCountFiles; /* Counter for files */
|
DWORD dwCountFiles; /* Counter for files */
|
||||||
DWORD dwCountDirs; /* Counter for directories */
|
DWORD dwCountDirs; /* Counter for directories */
|
||||||
ULARGE_INTEGER u64CountBytes; /* Counter for bytes */
|
ULARGE_INTEGER u64CountBytes; /* Counter for bytes */
|
||||||
ULARGE_INTEGER u64Temp; /* A temporary counter */
|
ULARGE_INTEGER u64Temp; /* A temporary counter */
|
||||||
|
|
||||||
/* Initialize Variables */
|
/* Initialize Variables */
|
||||||
ptrStartNode = NULL;
|
ptrStartNode = NULL;
|
||||||
|
@ -1539,6 +1540,7 @@ ULARGE_INTEGER u64Temp; /* A temporary counter */
|
||||||
dwCountFiles = 0;
|
dwCountFiles = 0;
|
||||||
dwCountDirs = 0;
|
dwCountDirs = 0;
|
||||||
u64CountBytes.QuadPart = 0;
|
u64CountBytes.QuadPart = 0;
|
||||||
|
fPoint= FALSE;
|
||||||
|
|
||||||
/* Create szFullPath */
|
/* Create szFullPath */
|
||||||
if (GetFullPathName(szPath, sizeof(szFullPath) / sizeof(TCHAR), szFullPath, &pszFilePart) == 0)
|
if (GetFullPathName(szPath, sizeof(szFullPath) / sizeof(TCHAR), szFullPath, &pszFilePart) == 0)
|
||||||
|
@ -1567,14 +1569,22 @@ ULARGE_INTEGER u64Temp; /* A temporary counter */
|
||||||
}
|
}
|
||||||
ptrNextNode = ptrStartNode;
|
ptrNextNode = ptrStartNode;
|
||||||
|
|
||||||
|
/*Checking ir szPath is a File with/wout extension*/
|
||||||
|
if (szPath[_tcslen(szPath) - 1] == _T('.'))
|
||||||
|
fPoint= TRUE;
|
||||||
|
|
||||||
/* Collect the results for the current folder */
|
/* Collect the results for the current folder */
|
||||||
hSearch = FindFirstFile(szFullPath, &wfdFileInfo);
|
hSearch = FindFirstFile(szFullPath, &wfdFileInfo);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (hSearch != INVALID_HANDLE_VALUE)
|
if (hSearch != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
/*If retrieved FileName has extension,and szPath doesnt have extension then JUMP the retrieved FileName*/
|
||||||
|
if(_tcschr(wfdFileInfo.cFileName,_T('.'))&&(fPoint==TRUE))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
/* Here we filter all the specified attributes */
|
/* Here we filter all the specified attributes */
|
||||||
if ((wfdFileInfo.dwFileAttributes & lpFlags->stAttribs.dwAttribMask )
|
}else if ((wfdFileInfo.dwFileAttributes & lpFlags->stAttribs.dwAttribMask )
|
||||||
== (lpFlags->stAttribs.dwAttribMask & lpFlags->stAttribs.dwAttribVal ))
|
== (lpFlags->stAttribs.dwAttribMask & lpFlags->stAttribs.dwAttribVal ))
|
||||||
{
|
{
|
||||||
ptrNextNode->ptrNext = cmd_alloc(sizeof(DIRFINDLISTNODE));
|
ptrNextNode->ptrNext = cmd_alloc(sizeof(DIRFINDLISTNODE));
|
||||||
|
|
Loading…
Reference in a new issue