From 657c30948694632e937da9a4e61219c5e4bf95a0 Mon Sep 17 00:00:00 2001 From: Dees_Troy Date: Mon, 10 Sep 2012 20:32:10 -0400 Subject: Zip install works again --- gui/action.cpp | 23 ++++++++++++++--------- gui/objects.hpp | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) (limited to 'gui') diff --git a/gui/action.cpp b/gui/action.cpp index aee56849f..3e19a6132 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -28,7 +29,6 @@ extern "C" { #include "../extra-functions.h" #include "../variables.h" -int install_zip_package(const char* zip_path_filename); void fix_perms(); void wipe_dalvik_cache(void); int check_backup_name(int show_error); @@ -53,7 +53,6 @@ int gui_start(); #include "rapidxml.hpp" #include "objects.hpp" - void curtainClose(void); GUIAction::GUIAction(xml_node<>* node) @@ -159,7 +158,7 @@ void GUIAction::simulate_progress_bar(void) } } -int GUIAction::flash_zip(std::string filename, std::string pageName, const int simulate) +int GUIAction::flash_zip(std::string filename, std::string pageName, const int simulate, int* wipe_cache) { int ret_val = 0; @@ -177,7 +176,10 @@ int GUIAction::flash_zip(std::string filename, std::string pageName, const int s int fd = -1; ZipArchive zip; - if (mzOpenZipArchive(filename.c_str(), &zip)) + if (!PartitionManager.Mount_By_Path(filename, true)) + return -1; + + if (mzOpenZipArchive(filename.c_str(), &zip)) { LOGE("Unable to open zip file.\n"); return -1; @@ -195,14 +197,14 @@ int GUIAction::flash_zip(std::string filename, std::string pageName, const int s !PageManager::LoadPackage("install", "/tmp/twrp.zip", "main")) { mzCloseZipArchive(&zip); - PageManager::SelectPackage("install"); + PageManager::SelectPackage("install"); gui_changePage("main"); } else { // In this case, we just use the default page mzCloseZipArchive(&zip); - gui_changePage(pageName); + gui_changePage(pageName); } if (fd >= 0) close(fd); @@ -210,7 +212,7 @@ int GUIAction::flash_zip(std::string filename, std::string pageName, const int s if (simulate) { simulate_progress_bar(); } else { - ret_val = install_zip_package(filename.c_str()); + ret_val = TWinstall_zip(filename.c_str(), wipe_cache); // Now, check if we need to ensure TWRP remains installed... struct stat st; @@ -624,14 +626,14 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) if (function == "flash") { - int i, ret_val = 0; + int i, ret_val = 0, wipe_cache = 0; for (i=0; i