From 13ef7c08cafb5d39c17a3b3e32f0ecf3a1107e2b Mon Sep 17 00:00:00 2001 From: "estade@chromium.org" Date: Thu, 20 Nov 2008 22:30:13 +0000 Subject: Port directory lister to allow the linux and mac test shells to display file directories. This is a revision of r5725. It doesn't break mac build. Review URL: http://codereview.chromium.org/11507 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5792 0039d316-1c4b-4281-b951-d872f2087c98 --- base/file_util.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'base/file_util.h') diff --git a/base/file_util.h b/base/file_util.h index e274d6a..0103003 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -14,6 +14,7 @@ #include #elif defined(OS_POSIX) #include +#include #endif #include @@ -323,6 +324,15 @@ bool SetCurrentDirectory(const std::wstring& current_directory); // program where latency does not matter. This class is blocking. class FileEnumerator { public: +#if defined(OS_WIN) + typedef WIN32_FIND_DATA FindInfo; +#elif defined(OS_POSIX) + typedef struct { + struct stat stat; + std::string filename; + } FindInfo; +#endif + enum FILE_TYPE { FILES = 0x1, DIRECTORIES = 0x2, @@ -361,6 +371,9 @@ class FileEnumerator { // Returns an empty string if there are no more results. std::wstring Next(); + // Write the file info into |info|. + void GetFindInfo(FindInfo* info); + private: std::wstring root_path_; bool recursive_; @@ -380,6 +393,7 @@ class FileEnumerator { HANDLE find_handle_; #elif defined(OS_POSIX) FTS* fts_; + FTSENT* fts_ent_; #endif DISALLOW_EVIL_CONSTRUCTORS(FileEnumerator); -- cgit v1.1