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

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

Issue 2894583002: Delete Filesystem::IterateDirectory and Filesystem::OpenFile. (Closed)
Patch Set: Check stream.Open return value. 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
« no previous file with comments | « webrtc/base/unixfilesystem.h ('k') | webrtc/base/win32filesystem.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 117
118 LOG(LS_INFO) << "Creating folder: " << pathname; 118 LOG(LS_INFO) << "Creating folder: " << pathname;
119 return (0 == ::mkdir(pathname.c_str(), mode)); 119 return (0 == ::mkdir(pathname.c_str(), mode));
120 } 120 }
121 121
122 bool UnixFilesystem::CreateFolder(const Pathname &path) { 122 bool UnixFilesystem::CreateFolder(const Pathname &path) {
123 return CreateFolder(path, 0755); 123 return CreateFolder(path, 0755);
124 } 124 }
125 125
126 FileStream *UnixFilesystem::OpenFile(const Pathname &filename,
127 const std::string &mode) {
128 FileStream *fs = new FileStream();
129 if (fs && !fs->Open(filename.pathname().c_str(), mode.c_str(), nullptr)) {
130 delete fs;
131 fs = nullptr;
132 }
133 return fs;
134 }
135
136 bool UnixFilesystem::DeleteFile(const Pathname &filename) { 126 bool UnixFilesystem::DeleteFile(const Pathname &filename) {
137 LOG(LS_INFO) << "Deleting file:" << filename.pathname(); 127 LOG(LS_INFO) << "Deleting file:" << filename.pathname();
138 128
139 if (!IsFile(filename)) { 129 if (!IsFile(filename)) {
140 RTC_DCHECK(IsFile(filename)); 130 RTC_DCHECK(IsFile(filename));
141 return false; 131 return false;
142 } 132 }
143 return ::unlink(filename.pathname().c_str()) == 0; 133 return ::unlink(filename.pathname().c_str()) == 0;
144 } 134 }
145 135
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 264
275 } // namespace rtc 265 } // namespace rtc
276 266
277 #if defined(__native_client__) 267 #if defined(__native_client__)
278 extern "C" int __attribute__((weak)) 268 extern "C" int __attribute__((weak))
279 link(const char* oldpath, const char* newpath) { 269 link(const char* oldpath, const char* newpath) {
280 errno = EACCES; 270 errno = EACCES;
281 return -1; 271 return -1;
282 } 272 }
283 #endif 273 #endif
OLDNEW
« no previous file with comments | « webrtc/base/unixfilesystem.h ('k') | webrtc/base/win32filesystem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698