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

Unified Diff: mojo/tools/package_manager/unpacker.cc

Issue 596913002: Add mojo package manager skeleton. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/tools/package_manager/unpacker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/tools/package_manager/unpacker.cc
diff --git a/mojo/tools/package_manager/unpacker.cc b/mojo/tools/package_manager/unpacker.cc
new file mode 100644
index 0000000000000000000000000000000000000000..39f26743bac72972e11da14dfcee3f4c0fcf0694
--- /dev/null
+++ b/mojo/tools/package_manager/unpacker.cc
@@ -0,0 +1,37 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/tools/package_manager/unpacker.h"
+
+#include "base/files/file_util.h"
+#include "base/logging.h"
+#include "third_party/zlib/google/zip.h"
+
+namespace mojo {
+
+Unpacker::Unpacker() {
+}
+
+Unpacker::~Unpacker() {
+ if (!dir_.empty()) {
+ printf("Deleting %s\n", dir_.value().c_str());
+ //DeleteFile(dir_, true);
+ }
+}
+
+bool Unpacker::Unpack(const base::FilePath& zip_file) {
+ DCHECK(zip_file_.empty());
+ zip_file_ = zip_file;
+
+ DCHECK(dir_.empty());
+ if (!CreateNewTempDirectory(base::FilePath::StringType(), &dir_))
+ return false;
+ if (!zip::Unzip(zip_file, dir_)) {
+ dir_ = base::FilePath();
+ return false;
+ }
+ return true;
+}
+
+} // namespace mojo
« no previous file with comments | « mojo/tools/package_manager/unpacker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698