fixed Windows DirectoryIterator bug with empty root dirs

This commit is contained in:
Guenter Obiltschnig
2007-05-01 11:51:21 +00:00
parent 0fc23174be
commit 2b493190e0
2 changed files with 14 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
// //
// DirectoryIterator_WIN32.cpp // DirectoryIterator_WIN32.cpp
// //
// $Id: //poco/Main/Foundation/src/DirectoryIterator_WIN32.cpp#12 $ // $Id: //poco/Main/Foundation/src/DirectoryIterator_WIN32.cpp#13 $
// //
// Library: Foundation // Library: Foundation
// Package: Filesystem // Package: Filesystem
@@ -55,10 +55,13 @@ DirectoryIteratorImpl::DirectoryIteratorImpl(const std::string& path): _fh(INVAL
if (GetLastError() != ERROR_NO_MORE_FILES) if (GetLastError() != ERROR_NO_MORE_FILES)
File::handleLastError(path); File::handleLastError(path);
} }
else
{
_current = _fd.cFileName; _current = _fd.cFileName;
if (_current == "." || _current == "..") if (_current == "." || _current == "..")
next(); next();
} }
}
DirectoryIteratorImpl::~DirectoryIteratorImpl() DirectoryIteratorImpl::~DirectoryIteratorImpl()

View File

@@ -1,7 +1,7 @@
// //
// DirectoryIterator_WIN32U.cpp // DirectoryIterator_WIN32U.cpp
// //
// $Id: //poco/Main/Foundation/src/DirectoryIterator_WIN32U.cpp#6 $ // $Id: //poco/Main/Foundation/src/DirectoryIterator_WIN32U.cpp#7 $
// //
// Library: Foundation // Library: Foundation
// Package: Filesystem // Package: Filesystem
@@ -59,10 +59,13 @@ DirectoryIteratorImpl::DirectoryIteratorImpl(const std::string& path): _fh(INVAL
if (GetLastError() != ERROR_NO_MORE_FILES) if (GetLastError() != ERROR_NO_MORE_FILES)
File::handleLastError(path); File::handleLastError(path);
} }
else
{
UnicodeConverter::toUTF8(_fd.cFileName, _current); UnicodeConverter::toUTF8(_fd.cFileName, _current);
if (_current == "." || _current == "..") if (_current == "." || _current == "..")
next(); next();
} }
}
DirectoryIteratorImpl::~DirectoryIteratorImpl() DirectoryIteratorImpl::~DirectoryIteratorImpl()