diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-06 21:23:07 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-06 21:23:07 +0000 |
commit | 49930c3ae4d0bb40b94cfde0425e8c825a526144 (patch) | |
tree | 010ee4721b79bdfd7a22ef0ff7efe56630582b39 /base/file_util.h | |
parent | 6ae23b8bfb3ee39e3a158b4b83a2230dcfe06c45 (diff) | |
download | chromium_src-49930c3ae4d0bb40b94cfde0425e8c825a526144.zip chromium_src-49930c3ae4d0bb40b94cfde0425e8c825a526144.tar.gz chromium_src-49930c3ae4d0bb40b94cfde0425e8c825a526144.tar.bz2 |
Define _FILE_OFFSET_BITS=64 in order to support large files (>2GB).
_FILE_OFFSET_BITS=64 is incompatible with fts (issue 17492), so
file_util::Delete, file_util::CopyDirectory file_util::FileEnumerator are
reimplemented without fts. Delete and CopyDirectory are now implemented using
FileEnumerator.
Patch from vandebo@google.com, original review:
http://codereview.chromium.org/160479
BUG=13718,17492
TEST=none
Review URL: http://codereview.chromium.org/165085
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22670 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util.h')
-rw-r--r-- | base/file_util.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/base/file_util.h b/base/file_util.h index 9e2636e7..71780f8 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -13,10 +13,7 @@ #if defined(OS_WIN) #include <windows.h> #elif defined(OS_POSIX) -// Keep the order as in fts(3): fts.h requires types defined in sys/types.h -#include <sys/types.h> #include <sys/stat.h> -#include <fts.h> #endif #include <stdio.h> @@ -421,6 +418,9 @@ class FileEnumerator { FILES = 1 << 0, DIRECTORIES = 1 << 1, INCLUDE_DOT_DOT = 1 << 2, +#if defined(OS_POSIX) + SHOW_SYM_LINKS = 1 << 4, +#endif }; // |root_path| is the starting directory to search for. It may or may not end @@ -485,8 +485,24 @@ class FileEnumerator { WIN32_FIND_DATA find_data_; HANDLE find_handle_; #elif defined(OS_POSIX) - FTS* fts_; - FTSENT* fts_ent_; + typedef struct { + FilePath filename; + struct stat stat; + } DirectoryEntryInfo; + + // Read the filenames in source into the vector of DirectoryEntryInfo's + static bool ReadDirectory(std::vector<DirectoryEntryInfo>* entries, + const FilePath& source, bool show_links); + + // Comparison function to neatly sort directory entries + static bool CompareFiles(const DirectoryEntryInfo& a, + const DirectoryEntryInfo& b); + + // The files in the current directory + std::vector<DirectoryEntryInfo> directory_entries_; + + // The next entry to use from the directory_entries_ vector + size_t current_directory_entry_; #endif DISALLOW_EVIL_CONSTRUCTORS(FileEnumerator); |