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

Side by Side Diff: mojo/tools/package_manager/unpacker.cc

Issue 600683002: Recursively load mojo packages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
« no previous file with comments | « mojo/tools/package_manager/package_manager_application.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/tools/package_manager/unpacker.h" 5 #include "mojo/tools/package_manager/unpacker.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "third_party/zlib/google/zip.h" 9 #include "third_party/zlib/google/zip.h"
10 10
11 namespace mojo { 11 namespace mojo {
12 12
13 Unpacker::Unpacker() { 13 Unpacker::Unpacker() {
14 } 14 }
15 15
16 Unpacker::~Unpacker() { 16 Unpacker::~Unpacker() {
17 if (!dir_.empty()) { 17 if (!dir_.empty())
18 printf("Deleting %s\n", dir_.value().c_str()); 18 DeleteFile(dir_, true);
19 //DeleteFile(dir_, true);
20 }
21 } 19 }
22 20
23 bool Unpacker::Unpack(const base::FilePath& zip_file) { 21 bool Unpacker::Unpack(const base::FilePath& zip_file) {
24 DCHECK(zip_file_.empty()); 22 DCHECK(zip_file_.empty());
25 zip_file_ = zip_file; 23 zip_file_ = zip_file;
26 24
27 DCHECK(dir_.empty()); 25 DCHECK(dir_.empty());
28 if (!CreateNewTempDirectory(base::FilePath::StringType(), &dir_)) 26 if (!CreateNewTempDirectory(base::FilePath::StringType(), &dir_))
29 return false; 27 return false;
30 if (!zip::Unzip(zip_file, dir_)) { 28 if (!zip::Unzip(zip_file, dir_)) {
31 dir_ = base::FilePath(); 29 dir_ = base::FilePath();
32 return false; 30 return false;
33 } 31 }
34 return true; 32 return true;
35 } 33 }
36 34
37 } // namespace mojo 35 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/tools/package_manager/package_manager_application.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698