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

Side by Side Diff: base/file_util.h

Issue 160479: Support files larger than 2GB (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 4 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_posix.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
17 #include <sys/types.h>
18 #include <sys/stat.h> 16 #include <sys/stat.h>
19 #include <fts.h>
20 #endif 17 #endif
21 18
22 #include <stdio.h> 19 #include <stdio.h>
23 20
24 #include <stack> 21 #include <stack>
25 #include <string> 22 #include <string>
26 #include <vector> 23 #include <vector>
27 24
28 #include "base/basictypes.h" 25 #include "base/basictypes.h"
29 #include "base/file_path.h" 26 #include "base/file_path.h"
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 typedef struct { 411 typedef struct {
415 struct stat stat; 412 struct stat stat;
416 std::string filename; 413 std::string filename;
417 } FindInfo; 414 } FindInfo;
418 #endif 415 #endif
419 416
420 enum FILE_TYPE { 417 enum FILE_TYPE {
421 FILES = 1 << 0, 418 FILES = 1 << 0,
422 DIRECTORIES = 1 << 1, 419 DIRECTORIES = 1 << 1,
423 INCLUDE_DOT_DOT = 1 << 2, 420 INCLUDE_DOT_DOT = 1 << 2,
421 #if defined(OS_POSIX)
422 SHOW_SYM_LINKS = 1 << 4,
423 #endif
424 }; 424 };
425 425
426 // |root_path| is the starting directory to search for. It may or may not end 426 // |root_path| is the starting directory to search for. It may or may not end
427 // in a slash. 427 // in a slash.
428 // 428 //
429 // If |recursive| is true, this will enumerate all matches in any 429 // If |recursive| is true, this will enumerate all matches in any
430 // subdirectories matched as well. It does a breadth-first search, so all 430 // subdirectories matched as well. It does a breadth-first search, so all
431 // files in one directory will be returned before any files in a 431 // files in one directory will be returned before any files in a
432 // subdirectory. 432 // subdirectory.
433 // 433 //
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 // Returns true if the given path's base name is ".". 478 // Returns true if the given path's base name is ".".
479 bool IsDot(const FilePath& path); 479 bool IsDot(const FilePath& path);
480 480
481 // Returns true if the given path's base name is "..". 481 // Returns true if the given path's base name is "..".
482 bool IsDotDot(const FilePath& path); 482 bool IsDotDot(const FilePath& path);
483 483
484 #if defined(OS_WIN) 484 #if defined(OS_WIN)
485 WIN32_FIND_DATA find_data_; 485 WIN32_FIND_DATA find_data_;
486 HANDLE find_handle_; 486 HANDLE find_handle_;
487 #elif defined(OS_POSIX) 487 #elif defined(OS_POSIX)
488 FTS* fts_; 488 typedef struct {
489 FTSENT* fts_ent_; 489 FilePath filename;
490 struct stat stat;
491 } DirectoryEntryInfo;
492
493 // Read the filenames in source into the vector of DirectoryEntryInfo's
494 static bool ReadDirectory(std::vector<DirectoryEntryInfo>* entries,
495 const FilePath& source, bool show_links);
496
497 // Comparison function to neatly sort directory entries
498 static bool CompareFiles(const DirectoryEntryInfo& a,
499 const DirectoryEntryInfo& b);
500
501 // The files in the current directory
502 std::vector<DirectoryEntryInfo> directory_entries_;
503
504 // The next entry to use from the directory_entries_ vector
505 size_t current_directory_entry_;
490 #endif 506 #endif
491 507
492 DISALLOW_EVIL_CONSTRUCTORS(FileEnumerator); 508 DISALLOW_EVIL_CONSTRUCTORS(FileEnumerator);
493 }; 509 };
494 510
495 class MemoryMappedFile { 511 class MemoryMappedFile {
496 public: 512 public:
497 // The default constructor sets all members to invalid/null values. 513 // The default constructor sets all members to invalid/null values.
498 MemoryMappedFile(); 514 MemoryMappedFile();
499 ~MemoryMappedFile(); 515 ~MemoryMappedFile();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 550
535 // Renames a file using the SHFileOperation API to ensure that the target file 551 // Renames a file using the SHFileOperation API to ensure that the target file
536 // gets the correct default security descriptor in the new path. 552 // gets the correct default security descriptor in the new path.
537 bool RenameFileAndResetSecurityDescriptor( 553 bool RenameFileAndResetSecurityDescriptor(
538 const FilePath& source_file_path, 554 const FilePath& source_file_path,
539 const FilePath& target_file_path); 555 const FilePath& target_file_path);
540 556
541 } // namespace file_util 557 } // namespace file_util
542 558
543 #endif // BASE_FILE_UTIL_H_ 559 #endif // BASE_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/file_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698