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

Side by Side Diff: base/i18n/file_util_icu.h

Issue 271056: Do some cleanup of file path name handling. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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/os_exchange_data_provider_win.cc ('k') | base/i18n/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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // File utilities that use the ICU library go in this file. 5 // File utilities that use the ICU library go in this file.
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_path.h"
9 #include "base/string16.h" 10 #include "base/string16.h"
10 11
11 class FilePath; 12 class FilePath;
12 13
13 namespace file_util { 14 namespace file_util {
14 15
15 // Returns true if file_name does not have any illegal character. The input 16 // Returns true if file_name does not have any illegal character. The input
16 // param has the same restriction as that for ReplaceIllegalCharacters. 17 // param has the same restriction as that for ReplaceIllegalCharacters.
17 bool IsFilenameLegal(const string16& file_name); 18 bool IsFilenameLegal(const string16& file_name);
18 19
19 // Replaces characters in 'file_name' that are illegal for file names with 20 // Replaces characters in 'file_name' that are illegal for file names with
20 // 'replace_char'. 'file_name' must not be a full or relative path, but just the 21 // 'replace_char'. 'file_name' must not be a full or relative path, but just the
21 // file name component. Any leading or trailing whitespace in 'file_name' is 22 // file name component (since slashes are considered illegal). Any leading or
22 // removed. 23 // trailing whitespace in 'file_name' is removed.
23 // Example: 24 // Example:
24 // file_name == "bad:file*name?.txt", changed to: "bad-file-name-.txt" when 25 // file_name == "bad:file*name?.txt", changed to: "bad-file-name-.txt" when
25 // 'replace_char' is '-'. 26 // 'replace_char' is '-'.
26 void ReplaceIllegalCharacters(std::wstring* file_name, int replace_char); 27 void ReplaceIllegalCharactersInPath(FilePath::StringType* file_name,
28 char replace_char);
27 29
28 // Compares two filenames using the current locale information. This can be 30 // Compares two filenames using the current locale information. This can be
29 // used to sort directory listings. It behaves like "operator<" for use in 31 // used to sort directory listings. It behaves like "operator<" for use in
30 // std::sort. 32 // std::sort.
31 bool LocaleAwareCompareFilenames(const FilePath& a, const FilePath& b); 33 bool LocaleAwareCompareFilenames(const FilePath& a, const FilePath& b);
32 34
33 } // namespace file_util 35 } // namespace file_util
OLDNEW
« no previous file with comments | « app/os_exchange_data_provider_win.cc ('k') | base/i18n/file_util_icu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698