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_win.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_win.cc')
-rw-r--r-- | base/file_util_win.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/base/file_util_win.cc b/base/file_util_win.cc index f59f87d..91b9e2b 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -419,8 +419,9 @@ bool UpdateShortcutLink(const wchar_t *source, const wchar_t *destination, } bool IsDirectoryEmpty(const std::wstring& dir_path) { - FileEnumerator files(FilePath(dir_path), - false, FileEnumerator::FILES_AND_DIRECTORIES); + FileEnumerator files(FilePath(dir_path), false, + static_cast<FileEnumerator::FILE_TYPE>( + FileEnumerator::FILES | FileEnumerator::DIRECTORIES)); if (files.Next().value().empty()) return true; return false; @@ -675,6 +676,8 @@ FileEnumerator::FileEnumerator(const FilePath& root_path, file_type_(file_type), is_in_find_op_(false), find_handle_(INVALID_HANDLE_VALUE) { + // INCLUDE_DOT_DOT must not be specified if recursive. + DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_))); pending_paths_.push(root_path); } @@ -687,6 +690,8 @@ FileEnumerator::FileEnumerator(const FilePath& root_path, is_in_find_op_(false), pattern_(pattern), find_handle_(INVALID_HANDLE_VALUE) { + // INCLUDE_DOT_DOT must not be specified if recursive. + DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_))); pending_paths_.push(root_path); } @@ -746,8 +751,7 @@ FilePath FileEnumerator::Next() { } FilePath cur_file(find_data_.cFileName); - // Skip over . and .. - if (L"." == cur_file.value() || L".." == cur_file.value()) + if (ShouldSkip(cur_file)) return Next(); // Construct the absolute filename. |