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

Side by Side Diff: base/file_util.h

Issue 126223: Replace std:;wstring with std::string in locale-name related APIs.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « app/resource_bundle_win.cc ('k') | base/file_util_icu.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 // Keep the order as in fts(3): fts.h requires types defined in sys/types.h 16 // Keep the order as in fts(3): fts.h requires types defined in sys/types.h
17 #include <sys/types.h> 17 #include <sys/types.h>
18 #include <sys/stat.h> 18 #include <sys/stat.h>
19 #include <fts.h> 19 #include <fts.h>
20 #endif 20 #endif
21 21
22 #include <stdio.h> 22 #include <stdio.h>
23 23
24 #include <stack> 24 #include <stack>
25 #include <string> 25 #include <string>
26 #include <vector> 26 #include <vector>
27 27
28 #include "base/basictypes.h" 28 #include "base/basictypes.h"
29 #include "base/file_path.h"
29 #include "base/scoped_ptr.h" 30 #include "base/scoped_ptr.h"
30 #include "base/file_path.h" 31 #include "base/string16.h"
31 32
32 namespace base { 33 namespace base {
33 class Time; 34 class Time;
34 } 35 }
35 36
36 namespace file_util { 37 namespace file_util {
37 38
38 //----------------------------------------------------------------------------- 39 //-----------------------------------------------------------------------------
39 // Functions that operate purely on a path string w/o touching the filesystem: 40 // Functions that operate purely on a path string w/o touching the filesystem:
40 41
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 111
111 // Replaces characters in 'file_name' that are illegal for file names with 112 // Replaces characters in 'file_name' that are illegal for file names with
112 // 'replace_char'. 'file_name' must not be a full or relative path, but just the 113 // 'replace_char'. 'file_name' must not be a full or relative path, but just the
113 // file name component. Any leading or trailing whitespace in 'file_name' is 114 // file name component. Any leading or trailing whitespace in 'file_name' is
114 // removed. 115 // removed.
115 // Example: 116 // Example:
116 // file_name == "bad:file*name?.txt", changed to: "bad-file-name-.txt" when 117 // file_name == "bad:file*name?.txt", changed to: "bad-file-name-.txt" when
117 // 'replace_char' is '-'. 118 // 'replace_char' is '-'.
118 void ReplaceIllegalCharacters(std::wstring* file_name, int replace_char); 119 void ReplaceIllegalCharacters(std::wstring* file_name, int replace_char);
119 120
121 // Returns true if file_name does not have any illegal character. The input
122 // param has the same restriction as that for ReplaceIllegalCharacters.
123 bool IsFilenameLegal(const string16& file_name);
124
120 //----------------------------------------------------------------------------- 125 //-----------------------------------------------------------------------------
121 // Functions that involve filesystem access or modification: 126 // Functions that involve filesystem access or modification:
122 127
123 // created on or after the given |file_time|. Doesn't count ".." or ".". 128 // created on or after the given |file_time|. Doesn't count ".." or ".".
124 // 129 //
125 // Note for POSIX environments: a file created before |file_time| 130 // Note for POSIX environments: a file created before |file_time|
126 // can be mis-detected as a newer file due to low precision of 131 // can be mis-detected as a newer file due to low precision of
127 // timestmap of file creation time. If you need to avoid such 132 // timestmap of file creation time. If you need to avoid such
128 // mis-detection perfectly, you should wait one second before 133 // mis-detection perfectly, you should wait one second before
129 // obtaining |file_time|. 134 // obtaining |file_time|.
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 530
526 // Renames a file using the SHFileOperation API to ensure that the target file 531 // Renames a file using the SHFileOperation API to ensure that the target file
527 // gets the correct default security descriptor in the new path. 532 // gets the correct default security descriptor in the new path.
528 bool RenameFileAndResetSecurityDescriptor( 533 bool RenameFileAndResetSecurityDescriptor(
529 const FilePath& source_file_path, 534 const FilePath& source_file_path,
530 const FilePath& target_file_path); 535 const FilePath& target_file_path);
531 536
532 } // namespace file_util 537 } // namespace file_util
533 538
534 #endif // BASE_FILE_UTIL_H_ 539 #endif // BASE_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « app/resource_bundle_win.cc ('k') | base/file_util_icu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698