Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/zip.h" | 5 #include "chrome/common/zip.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 zipFile zip_file = internal::OpenForZipping(dest_file.AsUTF8Unsafe(), | 124 zipFile zip_file = internal::OpenForZipping(dest_file.AsUTF8Unsafe(), |
| 125 APPEND_STATUS_CREATE); | 125 APPEND_STATUS_CREATE); |
| 126 | 126 |
| 127 if (!zip_file) { | 127 if (!zip_file) { |
| 128 DLOG(WARNING) << "couldn't create file " << dest_file.value(); | 128 DLOG(WARNING) << "couldn't create file " << dest_file.value(); |
| 129 return false; | 129 return false; |
| 130 } | 130 } |
| 131 | 131 |
| 132 bool success = true; | 132 bool success = true; |
| 133 file_util::FileEnumerator file_enumerator( | 133 file_util::FileEnumerator file_enumerator( |
| 134 src_dir, true, // recursive | 134 src_dir, true, // recursive |
|
jar (doing other things)
2012/08/06 18:27:02
nit: consider pushing args back onto line 133.
Haruki Sato
2012/08/06 23:22:18
Done.
| |
| 135 static_cast<file_util::FileEnumerator::FileType>( | 135 (file_util::FileEnumerator::FILES | |
| 136 file_util::FileEnumerator::FILES | | 136 file_util::FileEnumerator::DIRECTORIES)); |
| 137 file_util::FileEnumerator::DIRECTORIES)); | |
| 138 for (FilePath path = file_enumerator.Next(); !path.value().empty(); | 137 for (FilePath path = file_enumerator.Next(); !path.value().empty(); |
| 139 path = file_enumerator.Next()) { | 138 path = file_enumerator.Next()) { |
| 140 if (!filter_cb.Run(path)) { | 139 if (!filter_cb.Run(path)) { |
| 141 continue; | 140 continue; |
| 142 } | 141 } |
| 143 | 142 |
| 144 if (!AddEntryToZip(zip_file, path, src_dir)) { | 143 if (!AddEntryToZip(zip_file, path, src_dir)) { |
| 145 success = false; | 144 success = false; |
| 146 return false; | 145 return false; |
| 147 } | 146 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 160 if (include_hidden_files) { | 159 if (include_hidden_files) { |
| 161 return ZipWithFilterCallback( | 160 return ZipWithFilterCallback( |
| 162 src_dir, dest_file, base::Bind(&ExcludeNoFilesFilter)); | 161 src_dir, dest_file, base::Bind(&ExcludeNoFilesFilter)); |
| 163 } else { | 162 } else { |
| 164 return ZipWithFilterCallback( | 163 return ZipWithFilterCallback( |
| 165 src_dir, dest_file, base::Bind(&ExcludeHiddenFilesFilter)); | 164 src_dir, dest_file, base::Bind(&ExcludeHiddenFilesFilter)); |
| 166 } | 165 } |
| 167 } | 166 } |
| 168 | 167 |
| 169 } // namespace zip | 168 } // namespace zip |
| OLD | NEW |