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

Side by Side Diff: webrtc/base/win32filesystem.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/win32filesystem.h ('k') | no next file » | 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 Pathname parent(pathname); 56 Pathname parent(pathname);
57 parent.SetFolder(pathname.parent_folder()); 57 parent.SetFolder(pathname.parent_folder());
58 if (!CreateFolder(parent)) { 58 if (!CreateFolder(parent)) {
59 return false; 59 return false;
60 } 60 }
61 } 61 }
62 62
63 return (::CreateDirectory(path16.c_str(), nullptr) != 0); 63 return (::CreateDirectory(path16.c_str(), nullptr) != 0);
64 } 64 }
65 65
66 FileStream *Win32Filesystem::OpenFile(const Pathname &filename,
67 const std::string &mode) {
68 FileStream *fs = new FileStream();
69 if (fs && !fs->Open(filename.pathname().c_str(), mode.c_str(), nullptr)) {
70 delete fs;
71 fs = nullptr;
72 }
73 return fs;
74 }
75
76 bool Win32Filesystem::DeleteFile(const Pathname &filename) { 66 bool Win32Filesystem::DeleteFile(const Pathname &filename) {
77 LOG(LS_INFO) << "Deleting file " << filename.pathname(); 67 LOG(LS_INFO) << "Deleting file " << filename.pathname();
78 if (!IsFile(filename)) { 68 if (!IsFile(filename)) {
79 RTC_DCHECK(IsFile(filename)); 69 RTC_DCHECK(IsFile(filename));
80 return false; 70 return false;
81 } 71 }
82 return ::DeleteFile(ToUtf16(filename.pathname()).c_str()) != 0; 72 return ::DeleteFile(ToUtf16(filename.pathname()).c_str()) != 0;
83 } 73 }
84 74
85 bool Win32Filesystem::DeleteEmptyFolder(const Pathname &folder) { 75 bool Win32Filesystem::DeleteEmptyFolder(const Pathname &folder) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 183
194 bool Win32Filesystem::GetAppPathname(Pathname* path) { 184 bool Win32Filesystem::GetAppPathname(Pathname* path) {
195 TCHAR buffer[MAX_PATH + 1]; 185 TCHAR buffer[MAX_PATH + 1];
196 if (0 == ::GetModuleFileName(nullptr, buffer, arraysize(buffer))) 186 if (0 == ::GetModuleFileName(nullptr, buffer, arraysize(buffer)))
197 return false; 187 return false;
198 path->SetPathname(ToUtf8(buffer)); 188 path->SetPathname(ToUtf8(buffer));
199 return true; 189 return true;
200 } 190 }
201 191
202 } // namespace rtc 192 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/win32filesystem.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698