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

Unified Diff: chrome/common/zip.cc

Issue 340018: Filter out hidden files, both when loading extensions and when (Closed)
Patch Set: Created 11 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/zip.h ('k') | chrome/common/zip_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/zip.cc
diff --git a/chrome/common/zip.cc b/chrome/common/zip.cc
index 9c0adea6d97e06da5b35018acb28519b6d8f5a2d..097f035b95eb421b899ef7a31d69901bc27a8120 100644
--- a/chrome/common/zip.cc
+++ b/chrome/common/zip.cc
@@ -258,7 +258,8 @@ static bool AddEntryToZip(zipFile zip_file, const FilePath& path,
return success;
}
-bool Zip(const FilePath& src_dir, const FilePath& dest_file) {
+bool Zip(const FilePath& src_dir, const FilePath& dest_file,
+ bool include_hidden_files) {
DCHECK(file_util::DirectoryExists(src_dir));
#if defined(OS_WIN)
@@ -291,6 +292,9 @@ bool Zip(const FilePath& src_dir, const FilePath& dest_file) {
file_util::FileEnumerator::DIRECTORIES));
for (FilePath path = file_enumerator.Next(); !path.value().empty();
path = file_enumerator.Next()) {
+ if (!include_hidden_files && path.BaseName().ToWStringHack()[0] == L'.')
+ continue;
+
if (!AddEntryToZip(zip_file, path, src_dir)) {
success = false;
return false;
« no previous file with comments | « chrome/common/zip.h ('k') | chrome/common/zip_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698