Code in DirectoryIteratorImpl constructor includes:
_fh = FindFirstFileW(uFindPath.c_str(), &_fd);
if (_fh == INVALID_HANDLE_VALUE)
{
if (GetLastError() != ERROR_NO_MORE_FILES)
FileImpl::handleError(path);
}
UnicodeConverter::toUTF8(_fd.cFileName, _current);
if (_current == "." OR _current == "..")
next();
and this should be fixed to:
_fh = FindFirstFileW(uFindPath.c_str(), &_fd);
if (_fh == INVALID_HANDLE_VALUE)
{
if (GetLastError() != ERROR_NO_MORE_FILES)
FileImpl::handleError(path);
else
_current.clear();
}
else
{
UnicodeConverter::toUTF8(_fd.cFileName, _current);
if (_current == "." OR _current == "..")
next();
}
Definately needs fixed in the WIN32/WIN32U implementations - probably needs a similar fix in the UNIX implementation also. If not fixed, then get random invalid File.list() results on empty directories, and also causes File.remove(true) to throw up occasionally.
BTW, how do I format code in this comment box ?, I tried wrapping it in 'code' tags to no avail - so please accept my apologies for the bad formatting in the code above (replace the OR with ||).
Cheers,
Keith.





