Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: webrtc/base/fileutils.cc

Issue 2935933007: Delete class DirectoryIterator and FileRotatingStream read support. (Closed)
Patch Set: Drop an RTC_NOTREACHED. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/fileutils.h ('k') | webrtc/base/unixfilesystem.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/fileutils.cc
diff --git a/webrtc/base/fileutils.cc b/webrtc/base/fileutils.cc
index 187da1499462127de6d818bca648586e618fce38..e9df614fdaceefeac1a12befaa634f4fc1a137c1 100644
--- a/webrtc/base/fileutils.cc
+++ b/webrtc/base/fileutils.cc
@@ -27,96 +27,6 @@
namespace rtc {
-//////////////////////////
-// Directory Iterator //
-//////////////////////////
-
-// A DirectoryIterator is created with a given directory. It originally points
-// to the first file in the directory, and can be advanecd with Next(). This
-// allows you to get information about each file.
-
- // Constructor
-DirectoryIterator::DirectoryIterator()
-#ifdef WEBRTC_WIN
- : handle_(INVALID_HANDLE_VALUE) {
-#else
- : dir_(nullptr),
- dirent_(nullptr){
-#endif
-}
-
- // Destructor
-DirectoryIterator::~DirectoryIterator() {
-#if defined(WEBRTC_WIN)
- if (handle_ != INVALID_HANDLE_VALUE)
- ::FindClose(handle_);
-#else
- if (dir_)
- closedir(dir_);
-#endif
-}
-
- // Starts traversing a directory.
- // dir is the directory to traverse
- // returns true if the directory exists and is valid
-bool DirectoryIterator::Iterate(const Pathname &dir) {
- directory_ = dir.pathname();
-#if defined(WEBRTC_WIN)
- if (handle_ != INVALID_HANDLE_VALUE)
- ::FindClose(handle_);
- std::string d = dir.pathname() + '*';
- handle_ = ::FindFirstFile(ToUtf16(d).c_str(), &data_);
- if (handle_ == INVALID_HANDLE_VALUE)
- return false;
-#else
- if (dir_ != nullptr)
- closedir(dir_);
- dir_ = ::opendir(directory_.c_str());
- if (dir_ == nullptr)
- return false;
- dirent_ = readdir(dir_);
- if (dirent_ == nullptr)
- return false;
-
- if (::stat(std::string(directory_ + Name()).c_str(), &stat_) != 0)
- return false;
-#endif
- return true;
-}
-
- // Advances to the next file
- // returns true if there were more files in the directory.
-bool DirectoryIterator::Next() {
-#if defined(WEBRTC_WIN)
- return ::FindNextFile(handle_, &data_) == TRUE;
-#else
- dirent_ = ::readdir(dir_);
- if (dirent_ == nullptr)
- return false;
-
- return ::stat(std::string(directory_ + Name()).c_str(), &stat_) == 0;
-#endif
-}
-
- // returns true if the file currently pointed to is a directory
-bool DirectoryIterator::IsDirectory() const {
-#if defined(WEBRTC_WIN)
- return (data_.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FALSE;
-#else
- return S_ISDIR(stat_.st_mode);
-#endif
-}
-
- // returns the name of the file currently pointed to
-std::string DirectoryIterator::Name() const {
-#if defined(WEBRTC_WIN)
- return ToUtf8(data_.cFileName);
-#else
- RTC_DCHECK(dirent_);
- return dirent_->d_name;
-#endif
-}
-
FilesystemInterface* Filesystem::default_filesystem_ = nullptr;
FilesystemInterface *Filesystem::EnsureDefaultFilesystem() {
« no previous file with comments | « webrtc/base/fileutils.h ('k') | webrtc/base/unixfilesystem.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698