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,9 +55,12 @@ 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);
} }
_current = _fd.cFileName; else
if (_current == "." || _current == "..") {
next(); _current = _fd.cFileName;
if (_current == "." || _current == "..")
next();
}
} }

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,9 +59,12 @@ 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);
} }
UnicodeConverter::toUTF8(_fd.cFileName, _current); else
if (_current == "." || _current == "..") {
next(); UnicodeConverter::toUTF8(_fd.cFileName, _current);
if (_current == "." || _current == "..")
next();
}
} }