shlwapi: Correctly treat '.' when enumerating files in PathIsDirectoryEmptyW.
This commit is contained in:
parent
cffe06af80
commit
8758a8a671
|
@ -3872,13 +3872,13 @@ BOOL WINAPI PathIsDirectoryEmptyW(LPCWSTR lpszPath)
|
|||
WCHAR szSearch[MAX_PATH];
|
||||
DWORD dwLen;
|
||||
HANDLE hfind;
|
||||
BOOL retVal = FALSE;
|
||||
BOOL retVal = TRUE;
|
||||
WIN32_FIND_DATAW find_data;
|
||||
|
||||
TRACE("(%s)\n",debugstr_w(lpszPath));
|
||||
|
||||
if (!lpszPath || !PathIsDirectoryW(lpszPath))
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
lstrcpynW(szSearch, lpszPath, MAX_PATH);
|
||||
PathAddBackslashW(szSearch);
|
||||
|
@ -3888,14 +3888,23 @@ BOOL WINAPI PathIsDirectoryEmptyW(LPCWSTR lpszPath)
|
|||
|
||||
strcpyW(szSearch + dwLen, szAllFiles);
|
||||
hfind = FindFirstFileW(szSearch, &find_data);
|
||||
if (hfind != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
if (find_data.cFileName[0] == '.' && find_data.cFileName[1] == '.')
|
||||
/* The only directory entry should be the parent */
|
||||
retVal = !FindNextFileW(hfind, &find_data);
|
||||
FindClose(hfind);
|
||||
}
|
||||
if (hfind == INVALID_HANDLE_VALUE)
|
||||
return FALSE;
|
||||
|
||||
do
|
||||
{
|
||||
if (find_data.cFileName[0] == '.')
|
||||
{
|
||||
if (find_data.cFileName[1] == '\0') continue;
|
||||
if (find_data.cFileName[1] == '.' && find_data.cFileName[2] == '\0') continue;
|
||||
}
|
||||
|
||||
retVal = FALSE;
|
||||
break;
|
||||
}
|
||||
while (FindNextFileW(hfind, &find_data));
|
||||
|
||||
FindClose(hfind);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue