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

Side by Side Diff: base/file_util.h

Issue 16950027: Move ComputeDirectorySize to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try 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 | « no previous file | base/file_util.cc » ('j') | base/file_util_unittest.cc » ('J')
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 // This file contains utility functions for dealing with the local 5 // This file contains utility functions for dealing with the local
6 // filesystem. 6 // filesystem.
7 7
8 #ifndef BASE_FILE_UTIL_H_ 8 #ifndef BASE_FILE_UTIL_H_
9 #define BASE_FILE_UTIL_H_ 9 #define BASE_FILE_UTIL_H_
10 10
(...skipping 19 matching lines...) Expand all
30 #include "base/platform_file.h" 30 #include "base/platform_file.h"
31 #include "base/strings/string16.h" 31 #include "base/strings/string16.h"
32 32
33 #if defined(OS_POSIX) 33 #if defined(OS_POSIX)
34 #include "base/file_descriptor_posix.h" 34 #include "base/file_descriptor_posix.h"
35 #include "base/logging.h" 35 #include "base/logging.h"
36 #include "base/posix/eintr_wrapper.h" 36 #include "base/posix/eintr_wrapper.h"
37 #endif 37 #endif
38 38
39 namespace base { 39 namespace base {
40
40 class Time; 41 class Time;
41 42
43 extern bool g_bug108724_debug;
44
45 //-----------------------------------------------------------------------------
46 // Functions that involve filesystem access or modification:
47
42 // Returns an absolute version of a relative path. Returns an empty path on 48 // Returns an absolute version of a relative path. Returns an empty path on
43 // error. On POSIX, this function fails if the path does not exist. This 49 // error. On POSIX, this function fails if the path does not exist. This
44 // function can result in I/O so it can be slow. 50 // function can result in I/O so it can be slow.
45 BASE_EXPORT FilePath MakeAbsoluteFilePath(const FilePath& input); 51 BASE_EXPORT FilePath MakeAbsoluteFilePath(const FilePath& input);
46 52
47 } // namespace base
48
49 namespace file_util {
50
51 extern bool g_bug108724_debug;
52
53 //-----------------------------------------------------------------------------
54 // Functions that involve filesystem access or modification:
55
56 // Returns the total number of bytes used by all the files under |root_path|. 53 // Returns the total number of bytes used by all the files under |root_path|.
57 // If the path does not exist the function returns 0. 54 // If the path does not exist the function returns 0.
58 // 55 //
59 // This function is implemented using the FileEnumerator class so it is not 56 // This function is implemented using the FileEnumerator class so it is not
60 // particularly speedy in any platform. 57 // particularly speedy in any platform.
61 BASE_EXPORT int64 ComputeDirectorySize(const base::FilePath& root_path); 58 BASE_EXPORT int64 ComputeDirectorySize(const FilePath& root_path);
59
60 } // namespace base
61
62 namespace file_util {
62 63
63 // Deletes the given path, whether it's a file or a directory. 64 // Deletes the given path, whether it's a file or a directory.
64 // If it's a directory, it's perfectly happy to delete all of the 65 // If it's a directory, it's perfectly happy to delete all of the
65 // directory's contents. Passing true to recursive deletes 66 // directory's contents. Passing true to recursive deletes
66 // subdirectories and their contents as well. 67 // subdirectories and their contents as well.
67 // Returns true if successful, false otherwise. It is considered successful 68 // Returns true if successful, false otherwise. It is considered successful
68 // to attempt to delete a file that does not exist. 69 // to attempt to delete a file that does not exist.
69 // 70 //
70 // In posix environment and if |path| is a symbolic link, this deletes only 71 // In posix environment and if |path| is a symbolic link, this deletes only
71 // the symlink. (even if the symlink points to a non-existent file) 72 // the symlink. (even if the symlink points to a non-existent file)
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 451
451 // Attempts determine the FileSystemType for |path|. 452 // Attempts determine the FileSystemType for |path|.
452 // Returns false if |path| doesn't exist. 453 // Returns false if |path| doesn't exist.
453 BASE_EXPORT bool GetFileSystemType(const base::FilePath& path, 454 BASE_EXPORT bool GetFileSystemType(const base::FilePath& path,
454 FileSystemType* type); 455 FileSystemType* type);
455 #endif 456 #endif
456 457
457 } // namespace file_util 458 } // namespace file_util
458 459
459 #endif // BASE_FILE_UTIL_H_ 460 #endif // BASE_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/file_util.cc » ('j') | base/file_util_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698