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];
|
WCHAR szSearch[MAX_PATH];
|
||||||
DWORD dwLen;
|
DWORD dwLen;
|
||||||
HANDLE hfind;
|
HANDLE hfind;
|
||||||
BOOL retVal = FALSE;
|
BOOL retVal = TRUE;
|
||||||
WIN32_FIND_DATAW find_data;
|
WIN32_FIND_DATAW find_data;
|
||||||
|
|
||||||
TRACE("(%s)\n",debugstr_w(lpszPath));
|
TRACE("(%s)\n",debugstr_w(lpszPath));
|
||||||
|
|
||||||
if (!lpszPath || !PathIsDirectoryW(lpszPath))
|
if (!lpszPath || !PathIsDirectoryW(lpszPath))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
lstrcpynW(szSearch, lpszPath, MAX_PATH);
|
lstrcpynW(szSearch, lpszPath, MAX_PATH);
|
||||||
PathAddBackslashW(szSearch);
|
PathAddBackslashW(szSearch);
|
||||||
|
@ -3888,14 +3888,23 @@ BOOL WINAPI PathIsDirectoryEmptyW(LPCWSTR lpszPath)
|
||||||
|
|
||||||
strcpyW(szSearch + dwLen, szAllFiles);
|
strcpyW(szSearch + dwLen, szAllFiles);
|
||||||
hfind = FindFirstFileW(szSearch, &find_data);
|
hfind = FindFirstFileW(szSearch, &find_data);
|
||||||
if (hfind != INVALID_HANDLE_VALUE)
|
if (hfind == INVALID_HANDLE_VALUE)
|
||||||
{
|
return FALSE;
|
||||||
if (find_data.cFileName[0] == '.' && find_data.cFileName[1] == '.')
|
|
||||||
/* The only directory entry should be the parent */
|
|
||||||
retVal = !FindNextFileW(hfind, &find_data);
|
|
||||||
FindClose(hfind);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue