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

Side by Side Diff: base/file_util.h

Issue 73075: First step to port file_util::CountFilesCreatedAfter().... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 11 years, 8 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_unittest.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 12
13 #if defined(OS_WIN) 13 #if defined(OS_WIN)
14 #include <windows.h> 14 #include <windows.h>
15 #elif defined(OS_POSIX) 15 #elif defined(OS_POSIX)
16 #include <fts.h> 16 #include <fts.h>
17 #include <sys/stat.h> 17 #include <sys/stat.h>
18 #endif 18 #endif
19 19
20 #include <stdio.h> 20 #include <stdio.h>
21 21
22 #include <stack> 22 #include <stack>
23 #include <string> 23 #include <string>
24 #include <vector> 24 #include <vector>
25 25
26 #include "base/basictypes.h" 26 #include "base/basictypes.h"
27 #include "base/scoped_ptr.h" 27 #include "base/scoped_ptr.h"
28 #include "base/file_path.h" 28 #include "base/file_path.h"
29 29
30 namespace base {
31 class Time;
32 }
33
30 namespace file_util { 34 namespace file_util {
31 35
32 //----------------------------------------------------------------------------- 36 //-----------------------------------------------------------------------------
33 // Functions that operate purely on a path string w/o touching the filesystem: 37 // Functions that operate purely on a path string w/o touching the filesystem:
34 38
35 // Returns a vector of all of the components of the provided path. 39 // Returns a vector of all of the components of the provided path.
36 void PathComponents(const FilePath& path, 40 void PathComponents(const FilePath& path,
37 std::vector<FilePath::StringType>* components); 41 std::vector<FilePath::StringType>* components);
38 #if defined(OS_WIN) 42 #if defined(OS_WIN)
39 // Deprecated temporary compatibility function. 43 // Deprecated temporary compatibility function.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // Example: 132 // Example:
129 // file_name == "bad:file*name?.txt", changed to: "bad-file-name-.txt" when 133 // file_name == "bad:file*name?.txt", changed to: "bad-file-name-.txt" when
130 // 'replace_char' is '-'. 134 // 'replace_char' is '-'.
131 void ReplaceIllegalCharacters(std::wstring* file_name, int replace_char); 135 void ReplaceIllegalCharacters(std::wstring* file_name, int replace_char);
132 136
133 //----------------------------------------------------------------------------- 137 //-----------------------------------------------------------------------------
134 // Functions that involve filesystem access or modification: 138 // Functions that involve filesystem access or modification:
135 139
136 #if defined(OS_WIN) 140 #if defined(OS_WIN)
137 // Returns the number of files matching the current path that were 141 // Returns the number of files matching the current path that were
138 // created on or after the given FILETIME. Doesn't count ".." or ".". 142 // created on or after the given |file_time|. Doesn't count ".." or ".".
139 // Filetime is UTC filetime, not LocalFiletime. 143 int CountFilesCreatedAfter(const FilePath& path,
140 int CountFilesCreatedAfter(const std::wstring& path, 144 const base::Time& file_time);
141 const FILETIME& file_time);
142 #endif // defined(OS_WIN) 145 #endif // defined(OS_WIN)
143 146
144 // Deletes the given path, whether it's a file or a directory. 147 // Deletes the given path, whether it's a file or a directory.
145 // If it's a directory, it's perfectly happy to delete all of the 148 // If it's a directory, it's perfectly happy to delete all of the
146 // directory's contents. Passing true to recursive deletes 149 // directory's contents. Passing true to recursive deletes
147 // subdirectories and their contents as well. 150 // subdirectories and their contents as well.
148 // Returns true if successful, false otherwise. 151 // Returns true if successful, false otherwise.
149 // 152 //
150 // WARNING: USING THIS WITH recursive==true IS EQUIVALENT 153 // WARNING: USING THIS WITH recursive==true IS EQUIVALENT
151 // TO "rm -rf", SO USE WITH CAUTION. 154 // TO "rm -rf", SO USE WITH CAUTION.
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 508
506 // Renames a file using the SHFileOperation API to ensure that the target file 509 // Renames a file using the SHFileOperation API to ensure that the target file
507 // gets the correct default security descriptor in the new path. 510 // gets the correct default security descriptor in the new path.
508 bool RenameFileAndResetSecurityDescriptor( 511 bool RenameFileAndResetSecurityDescriptor(
509 const FilePath& source_file_path, 512 const FilePath& source_file_path,
510 const FilePath& target_file_path); 513 const FilePath& target_file_path);
511 514
512 } // namespace file_util 515 } // namespace file_util
513 516
514 #endif // BASE_FILE_UTIL_H_ 517 #endif // BASE_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698