summaryrefslogtreecommitdiffstats
path: root/chrome/common/zip.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-28 02:30:43 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-28 02:30:43 +0000
commited45566a74d2a8dae55ab4e2589ce5f0d78e49b2 (patch)
tree7c24abaa9d7e76f2482e9ef75be0c25bc2319a9a /chrome/common/zip.cc
parenta4c34a20c8b0a2fae699edbacf1e82655dab147f (diff)
downloadchromium_src-ed45566a74d2a8dae55ab4e2589ce5f0d78e49b2.zip
chromium_src-ed45566a74d2a8dae55ab4e2589ce5f0d78e49b2.tar.gz
chromium_src-ed45566a74d2a8dae55ab4e2589ce5f0d78e49b2.tar.bz2
Filter out hidden files, both when loading extensions and when
packaging them. We also special case the common OS X zip dropping "__MACOSX" when loading extensions. BUG=23004 Review URL: http://codereview.chromium.org/340018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30312 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/zip.cc')
-rw-r--r--chrome/common/zip.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/chrome/common/zip.cc b/chrome/common/zip.cc
index 9c0adea..097f035 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;