diff options
author | yuzo@chromium.org <yuzo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-09 05:57:38 +0000 |
---|---|---|
committer | yuzo@chromium.org <yuzo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-09 05:57:38 +0000 |
commit | 8199b3ae54cd41ff1012a4cae3640028043b0bb4 (patch) | |
tree | 5718d8e8cdc3889a7c82271f0beb8094b0914531 /base/file_util.cc | |
parent | 9c0b3e3a30ab2246a9385b978e86003d4fc8ceb9 (diff) | |
download | chromium_src-8199b3ae54cd41ff1012a4cae3640028043b0bb4.zip chromium_src-8199b3ae54cd41ff1012a4cae3640028043b0bb4.tar.gz chromium_src-8199b3ae54cd41ff1012a4cae3640028043b0bb4.tar.bz2 |
Include a parent directory link in the file list for file:///somepath
Also, order files/directories lexicographically.
TEST=on linux, type file:///usr/ in the address bar and make sure the contents
are sorted and include an entry for '..', which is [parent directory].
On windows, type file:///C:/Users/ .
BUG=12621, 12812
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17933 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util.cc')
-rw-r--r-- | base/file_util.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/base/file_util.cc b/base/file_util.cc index 8eec3ac..5f18674 100644 --- a/base/file_util.cc +++ b/base/file_util.cc @@ -426,4 +426,23 @@ void UpOneDirectoryOrEmpty(std::wstring* dir) { int WriteFile(const std::wstring& filename, const char* data, int size) { return WriteFile(FilePath::FromWStringHack(filename), data, size); } + +/////////////////////////////////////////////// +// FileEnumerator +// +// Note: the main logic is in file_util_<platform>.cc + +bool FileEnumerator::ShouldSkip(const FilePath& path) { + FilePath::StringType basename = path.BaseName().value(); + return IsDot(path) || (IsDotDot(path) && !(INCLUDE_DOT_DOT & file_type_)); +} + +bool FileEnumerator::IsDot(const FilePath& path) { + return FILE_PATH_LITERAL(".") == path.BaseName().value(); +} + +bool FileEnumerator::IsDotDot(const FilePath& path) { + return FILE_PATH_LITERAL("..") == path.BaseName().value(); +} + } // namespace |