From ed45566a74d2a8dae55ab4e2589ce5f0d78e49b2 Mon Sep 17 00:00:00 2001 From: "aa@chromium.org" Date: Wed, 28 Oct 2009 02:30:43 +0000 Subject: 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 --- chrome/common/zip.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'chrome/common/zip.cc') 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; -- cgit v1.1