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

Side by Side Diff: base/file_util.h

Issue 267001: Separate out some more ICU from base and into base/i18n.... (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 | « base/base.gyp ('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
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // absolute paths before doing the comparison. 96 // absolute paths before doing the comparison.
97 bool ContainsPath(const FilePath& parent, const FilePath& child); 97 bool ContainsPath(const FilePath& parent, const FilePath& child);
98 98
99 // Deprecated compatibility function. Use FilePath::InsertBeforeExtension. 99 // Deprecated compatibility function. Use FilePath::InsertBeforeExtension.
100 void InsertBeforeExtension(FilePath* path, const FilePath::StringType& suffix); 100 void InsertBeforeExtension(FilePath* path, const FilePath::StringType& suffix);
101 101
102 // Deprecated compatibility function. Use FilePath::ReplaceExtension. 102 // Deprecated compatibility function. Use FilePath::ReplaceExtension.
103 void ReplaceExtension(FilePath* file_name, 103 void ReplaceExtension(FilePath* file_name,
104 const FilePath::StringType& extension); 104 const FilePath::StringType& extension);
105 105
106 // Replaces characters in 'file_name' that are illegal for file names with
107 // 'replace_char'. 'file_name' must not be a full or relative path, but just the
108 // file name component. Any leading or trailing whitespace in 'file_name' is
109 // removed.
110 // Example:
111 // file_name == "bad:file*name?.txt", changed to: "bad-file-name-.txt" when
112 // 'replace_char' is '-'.
113 void ReplaceIllegalCharacters(std::wstring* file_name, int replace_char);
114
115 // Returns true if file_name does not have any illegal character. The input
116 // param has the same restriction as that for ReplaceIllegalCharacters.
117 bool IsFilenameLegal(const string16& file_name);
118
119 //----------------------------------------------------------------------------- 106 //-----------------------------------------------------------------------------
120 // Functions that involve filesystem access or modification: 107 // Functions that involve filesystem access or modification:
121 108
122 // created on or after the given |file_time|. Doesn't count ".." or ".". 109 // created on or after the given |file_time|. Doesn't count ".." or ".".
123 // 110 //
124 // Note for POSIX environments: a file created before |file_time| 111 // Note for POSIX environments: a file created before |file_time|
125 // can be mis-detected as a newer file due to low precision of 112 // can be mis-detected as a newer file due to low precision of
126 // timestmap of file creation time. If you need to avoid such 113 // timestmap of file creation time. If you need to avoid such
127 // mis-detection perfectly, you should wait one second before 114 // mis-detection perfectly, you should wait one second before
128 // obtaining |file_time|. 115 // obtaining |file_time|.
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 #elif defined(OS_POSIX) 470 #elif defined(OS_POSIX)
484 typedef struct { 471 typedef struct {
485 FilePath filename; 472 FilePath filename;
486 struct stat stat; 473 struct stat stat;
487 } DirectoryEntryInfo; 474 } DirectoryEntryInfo;
488 475
489 // Read the filenames in source into the vector of DirectoryEntryInfo's 476 // Read the filenames in source into the vector of DirectoryEntryInfo's
490 static bool ReadDirectory(std::vector<DirectoryEntryInfo>* entries, 477 static bool ReadDirectory(std::vector<DirectoryEntryInfo>* entries,
491 const FilePath& source, bool show_links); 478 const FilePath& source, bool show_links);
492 479
493 // Comparison function to neatly sort directory entries
494 static bool CompareFiles(const DirectoryEntryInfo& a,
495 const DirectoryEntryInfo& b);
496
497 // The files in the current directory 480 // The files in the current directory
498 std::vector<DirectoryEntryInfo> directory_entries_; 481 std::vector<DirectoryEntryInfo> directory_entries_;
499 482
500 // The next entry to use from the directory_entries_ vector 483 // The next entry to use from the directory_entries_ vector
501 size_t current_directory_entry_; 484 size_t current_directory_entry_;
502 #endif 485 #endif
503 486
504 DISALLOW_EVIL_CONSTRUCTORS(FileEnumerator); 487 DISALLOW_COPY_AND_ASSIGN(FileEnumerator);
505 }; 488 };
506 489
507 class MemoryMappedFile { 490 class MemoryMappedFile {
508 public: 491 public:
509 // The default constructor sets all members to invalid/null values. 492 // The default constructor sets all members to invalid/null values.
510 MemoryMappedFile(); 493 MemoryMappedFile();
511 ~MemoryMappedFile(); 494 ~MemoryMappedFile();
512 495
513 // Opens an existing file and maps it into memory. Access is restricted to 496 // Opens an existing file and maps it into memory. Access is restricted to
514 // read only. If this object already points to a valid memory mapped file 497 // read only. If this object already points to a valid memory mapped file
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 529
547 // Renames a file using the SHFileOperation API to ensure that the target file 530 // Renames a file using the SHFileOperation API to ensure that the target file
548 // gets the correct default security descriptor in the new path. 531 // gets the correct default security descriptor in the new path.
549 bool RenameFileAndResetSecurityDescriptor( 532 bool RenameFileAndResetSecurityDescriptor(
550 const FilePath& source_file_path, 533 const FilePath& source_file_path,
551 const FilePath& target_file_path); 534 const FilePath& target_file_path);
552 535
553 } // namespace file_util 536 } // namespace file_util
554 537
555 #endif // BASE_FILE_UTIL_H_ 538 #endif // BASE_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « base/base.gyp ('k') | base/file_util_icu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698