diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
commit | 2d37894b1b037cf24231090eda8589bbb44fb6fc (patch) | |
tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/poco/Foundation/src/DirectoryIterator_UNIX.cpp | |
parent | 718c552901d703c502ccbefdfc3c9028d608b947 (diff) | |
download | ydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/poco/Foundation/src/DirectoryIterator_UNIX.cpp')
-rw-r--r-- | contrib/libs/poco/Foundation/src/DirectoryIterator_UNIX.cpp | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/contrib/libs/poco/Foundation/src/DirectoryIterator_UNIX.cpp b/contrib/libs/poco/Foundation/src/DirectoryIterator_UNIX.cpp index d16bbafa4b..16be5051ea 100644 --- a/contrib/libs/poco/Foundation/src/DirectoryIterator_UNIX.cpp +++ b/contrib/libs/poco/Foundation/src/DirectoryIterator_UNIX.cpp @@ -1,64 +1,64 @@ -// -// DirectoryIterator_UNIX.cpp -// -// Library: Foundation -// Package: Filesystem -// Module: DirectoryIterator -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/DirectoryIterator_UNIX.h" -#if defined(POCO_VXWORKS) -#include "Poco/File_VX.h" -#else -#include "Poco/File_UNIX.h" -#endif -#include "Poco/Path.h" - - -namespace Poco { - - -DirectoryIteratorImpl::DirectoryIteratorImpl(const std::string& path): _pDir(0), _rc(1) -{ - Path p(path); - p.makeFile(); - -#if defined(POCO_VXWORKS) - _pDir = opendir(const_cast<char*>(p.toString().c_str())); -#else - _pDir = opendir(p.toString().c_str()); -#endif - if (!_pDir) File::handleLastError(path); - - next(); -} - - -DirectoryIteratorImpl::~DirectoryIteratorImpl() -{ - if (_pDir) closedir(_pDir); -} - - -const std::string& DirectoryIteratorImpl::next() -{ - do - { - struct dirent* pEntry = readdir(_pDir); - if (pEntry) - _current = pEntry->d_name; - else - _current.clear(); - } - while (_current == "." || _current == ".."); - return _current; -} - - -} // namespace Poco +// +// DirectoryIterator_UNIX.cpp +// +// Library: Foundation +// Package: Filesystem +// Module: DirectoryIterator +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/DirectoryIterator_UNIX.h" +#if defined(POCO_VXWORKS) +#include "Poco/File_VX.h" +#else +#include "Poco/File_UNIX.h" +#endif +#include "Poco/Path.h" + + +namespace Poco { + + +DirectoryIteratorImpl::DirectoryIteratorImpl(const std::string& path): _pDir(0), _rc(1) +{ + Path p(path); + p.makeFile(); + +#if defined(POCO_VXWORKS) + _pDir = opendir(const_cast<char*>(p.toString().c_str())); +#else + _pDir = opendir(p.toString().c_str()); +#endif + if (!_pDir) File::handleLastError(path); + + next(); +} + + +DirectoryIteratorImpl::~DirectoryIteratorImpl() +{ + if (_pDir) closedir(_pDir); +} + + +const std::string& DirectoryIteratorImpl::next() +{ + do + { + struct dirent* pEntry = readdir(_pDir); + if (pEntry) + _current = pEntry->d_name; + else + _current.clear(); + } + while (_current == "." || _current == ".."); + return _current; +} + + +} // namespace Poco |