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

Side by Side Diff: base/file_util.cc

Issue 15812007: Make file_util::CreateDirectory return an error, not just a bool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: call the right function on windows Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/file_util.h ('k') | base/file_util_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/file_util.h" 5 #include "base/file_util.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <io.h> 8 #include <io.h>
9 #endif 9 #endif
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 178 }
179 179
180 FILE* CreateAndOpenTemporaryFile(FilePath* path) { 180 FILE* CreateAndOpenTemporaryFile(FilePath* path) {
181 FilePath directory; 181 FilePath directory;
182 if (!GetTempDir(&directory)) 182 if (!GetTempDir(&directory))
183 return NULL; 183 return NULL;
184 184
185 return CreateAndOpenTemporaryFileInDir(directory, path); 185 return CreateAndOpenTemporaryFileInDir(directory, path);
186 } 186 }
187 187
188 bool CreateDirectory(const base::FilePath& full_path) {
189 return CreateDirectoryAndGetError(full_path, NULL);
190 }
191
188 bool GetFileSize(const FilePath& file_path, int64* file_size) { 192 bool GetFileSize(const FilePath& file_path, int64* file_size) {
189 base::PlatformFileInfo info; 193 base::PlatformFileInfo info;
190 if (!GetFileInfo(file_path, &info)) 194 if (!GetFileInfo(file_path, &info))
191 return false; 195 return false;
192 *file_size = info.size; 196 *file_size = info.size;
193 return true; 197 return true;
194 } 198 }
195 199
196 bool TouchFile(const FilePath& path, 200 bool TouchFile(const FilePath& path,
197 const base::Time& last_accessed, 201 const base::Time& last_accessed,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 272
269 int64 ComputeDirectorySize(const FilePath& root_path) { 273 int64 ComputeDirectorySize(const FilePath& root_path) {
270 int64 running_size = 0; 274 int64 running_size = 0;
271 FileEnumerator file_iter(root_path, true, FileEnumerator::FILES); 275 FileEnumerator file_iter(root_path, true, FileEnumerator::FILES);
272 while (!file_iter.Next().empty()) 276 while (!file_iter.Next().empty())
273 running_size += file_iter.GetInfo().GetSize(); 277 running_size += file_iter.GetInfo().GetSize();
274 return running_size; 278 return running_size;
275 } 279 }
276 280
277 } // namespace 281 } // namespace
OLDNEW
« no previous file with comments | « base/file_util.h ('k') | base/file_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698