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

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: xml file; use the new errors 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
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 176 }
177 177
178 FILE* CreateAndOpenTemporaryFile(FilePath* path) { 178 FILE* CreateAndOpenTemporaryFile(FilePath* path) {
179 FilePath directory; 179 FilePath directory;
180 if (!GetTempDir(&directory)) 180 if (!GetTempDir(&directory))
181 return NULL; 181 return NULL;
182 182
183 return CreateAndOpenTemporaryFileInDir(directory, path); 183 return CreateAndOpenTemporaryFileInDir(directory, path);
184 } 184 }
185 185
186 bool CreateDirectory(const base::FilePath& full_path) {
187 return CreateDirectoryAndGetError(full_path, NULL);
188 }
189
186 bool GetFileSize(const FilePath& file_path, int64* file_size) { 190 bool GetFileSize(const FilePath& file_path, int64* file_size) {
187 base::PlatformFileInfo info; 191 base::PlatformFileInfo info;
188 if (!GetFileInfo(file_path, &info)) 192 if (!GetFileInfo(file_path, &info))
189 return false; 193 return false;
190 *file_size = info.size; 194 *file_size = info.size;
191 return true; 195 return true;
192 } 196 }
193 197
194 bool TouchFile(const FilePath& path, 198 bool TouchFile(const FilePath& path,
195 const base::Time& last_accessed, 199 const base::Time& last_accessed,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // Note: the main logic is in file_util_<platform>.cc 291 // Note: the main logic is in file_util_<platform>.cc
288 292
289 bool FileEnumerator::ShouldSkip(const FilePath& path) { 293 bool FileEnumerator::ShouldSkip(const FilePath& path) {
290 FilePath::StringType basename = path.BaseName().value(); 294 FilePath::StringType basename = path.BaseName().value();
291 return basename == FILE_PATH_LITERAL(".") || 295 return basename == FILE_PATH_LITERAL(".") ||
292 (basename == FILE_PATH_LITERAL("..") && 296 (basename == FILE_PATH_LITERAL("..") &&
293 !(INCLUDE_DOT_DOT & file_type_)); 297 !(INCLUDE_DOT_DOT & file_type_));
294 } 298 }
295 299
296 } // namespace 300 } // namespace
OLDNEW
« no previous file with comments | « base/file_util.h ('k') | base/file_util_posix.cc » ('j') | base/file_util_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698