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

Side by Side Diff: webrtc/base/fileutils.cc

Issue 2898753002: ReadDirectory() added in webrtc/test/testsupport/fileutils.h (Closed)
Patch Set: commented lines removed Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 23 matching lines...) Expand all
34 // A DirectoryIterator is created with a given directory. It originally points 34 // A DirectoryIterator is created with a given directory. It originally points
35 // to the first file in the directory, and can be advanecd with Next(). This 35 // to the first file in the directory, and can be advanecd with Next(). This
36 // allows you to get information about each file. 36 // allows you to get information about each file.
37 37
38 // Constructor 38 // Constructor
39 DirectoryIterator::DirectoryIterator() 39 DirectoryIterator::DirectoryIterator()
40 #ifdef WEBRTC_WIN 40 #ifdef WEBRTC_WIN
41 : handle_(INVALID_HANDLE_VALUE) { 41 : handle_(INVALID_HANDLE_VALUE) {
42 #else 42 #else
43 : dir_(nullptr), 43 : dir_(nullptr),
44 dirent_(nullptr){ 44 dirent_(nullptr) {
45 #endif 45 #endif
46 } 46 }
47 47
48 // Destructor 48 // Destructor
49 DirectoryIterator::~DirectoryIterator() { 49 DirectoryIterator::~DirectoryIterator() {
50 #if defined(WEBRTC_WIN) 50 #if defined(WEBRTC_WIN)
51 if (handle_ != INVALID_HANDLE_VALUE) 51 if (handle_ != INVALID_HANDLE_VALUE)
52 ::FindClose(handle_); 52 ::FindClose(handle_);
53 #else 53 #else
54 if (dir_) 54 if (dir_)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // returns the name of the file currently pointed to 110 // returns the name of the file currently pointed to
111 std::string DirectoryIterator::Name() const { 111 std::string DirectoryIterator::Name() const {
112 #if defined(WEBRTC_WIN) 112 #if defined(WEBRTC_WIN)
113 return ToUtf8(data_.cFileName); 113 return ToUtf8(data_.cFileName);
114 #else 114 #else
115 RTC_DCHECK(dirent_); 115 RTC_DCHECK(dirent_);
116 return dirent_->d_name; 116 return dirent_->d_name;
117 #endif 117 #endif
118 } 118 }
119 119
120 Pathname DirectoryIterator::Path() const {
121 if (IsDirectory()) {
122 // Path to a directory.
123 rtc::Pathname dir(directory_);
124 dir.AppendFolder(Name());
125 return dir;
126 } else {
127 // Path to a file.
128 return rtc::Pathname(directory_, Name());
129 }
130 }
131
120 FilesystemInterface* Filesystem::default_filesystem_ = nullptr; 132 FilesystemInterface* Filesystem::default_filesystem_ = nullptr;
121 133
122 FilesystemInterface *Filesystem::EnsureDefaultFilesystem() { 134 FilesystemInterface *Filesystem::EnsureDefaultFilesystem() {
123 if (!default_filesystem_) { 135 if (!default_filesystem_) {
124 #if defined(WEBRTC_WIN) 136 #if defined(WEBRTC_WIN)
125 default_filesystem_ = new Win32Filesystem(); 137 default_filesystem_ = new Win32Filesystem();
126 #else 138 #else
127 default_filesystem_ = new UnixFilesystem(); 139 default_filesystem_ = new UnixFilesystem();
128 #endif 140 #endif
129 } 141 }
130 return default_filesystem_; 142 return default_filesystem_;
131 } 143 }
132 144
133 DirectoryIterator* FilesystemInterface::IterateDirectory() { 145 DirectoryIterator* FilesystemInterface::IterateDirectory() {
134 return new DirectoryIterator(); 146 return new DirectoryIterator();
135 } 147 }
136 148
137 } // namespace rtc 149 } // namespace rtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698