OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/installer/setup/archive_patch_helper.h" | 5 #include "chrome/installer/setup/archive_patch_helper.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/installer/util/lzma_util.h" | 9 #include "chrome/installer/util/lzma_util.h" |
10 #include "courgette/courgette.h" | 10 #include "courgette/courgette.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 patch_source, target); | 33 patch_source, target); |
34 return (instance.Uncompress(NULL) && | 34 return (instance.Uncompress(NULL) && |
35 (instance.EnsemblePatch() || instance.BinaryPatch())); | 35 (instance.EnsemblePatch() || instance.BinaryPatch())); |
36 } | 36 } |
37 | 37 |
38 bool ArchivePatchHelper::Uncompress(base::FilePath* last_uncompressed_file) { | 38 bool ArchivePatchHelper::Uncompress(base::FilePath* last_uncompressed_file) { |
39 // The target shouldn't already exist. | 39 // The target shouldn't already exist. |
40 DCHECK(!base::PathExists(target_)); | 40 DCHECK(!base::PathExists(target_)); |
41 | 41 |
42 // UnPackArchive takes care of logging. | 42 // UnPackArchive takes care of logging. |
43 string16 output_file; | 43 base::string16 output_file; |
44 int32 lzma_result = LzmaUtil::UnPackArchive(compressed_archive_.value(), | 44 int32 lzma_result = LzmaUtil::UnPackArchive(compressed_archive_.value(), |
45 working_directory_.value(), | 45 working_directory_.value(), |
46 &output_file); | 46 &output_file); |
47 if (lzma_result != NO_ERROR) | 47 if (lzma_result != NO_ERROR) |
48 return false; | 48 return false; |
49 | 49 |
50 last_uncompressed_file_ = base::FilePath(output_file); | 50 last_uncompressed_file_ = base::FilePath(output_file); |
51 if (last_uncompressed_file) | 51 if (last_uncompressed_file) |
52 *last_uncompressed_file = last_uncompressed_file_; | 52 *last_uncompressed_file = last_uncompressed_file_; |
53 return true; | 53 return true; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 << " and generating file " << target_.value() | 96 << " and generating file " << target_.value() |
97 << " using bsdiff. err=" << result; | 97 << " using bsdiff. err=" << result; |
98 | 98 |
99 // Ensure a partial output is not left behind. | 99 // Ensure a partial output is not left behind. |
100 base::DeleteFile(target_, false); | 100 base::DeleteFile(target_, false); |
101 | 101 |
102 return false; | 102 return false; |
103 } | 103 } |
104 | 104 |
105 } // namespace installer | 105 } // namespace installer |
OLD | NEW |