From 19fb79c722622ac4a068e258501ab4b161420cda Mon Sep 17 00:00:00 2001 From: bigbiff bigbiff Date: Mon, 5 Sep 2016 21:04:51 -0400 Subject: ADB Backup: add ability for TWRP GUI to restore Restore adb backup files that TWRP made to your PC. Put files in your backup directory to see them. e.g. /sdcard/TWRP/BACKUPS/ Change-Id: I2c57970d77b64c39a302159041456e761c185259 --- gui/fileselector.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'gui/fileselector.cpp') diff --git a/gui/fileselector.cpp b/gui/fileselector.cpp index a992b80ea..c4aaab168 100644 --- a/gui/fileselector.cpp +++ b/gui/fileselector.cpp @@ -30,6 +30,7 @@ extern "C" { #include "objects.hpp" #include "../data.hpp" #include "../twrp-functions.hpp" +#include "../adbbu/libtwadbbu.hpp" int GUIFileSelector::mSortOrder = 0; @@ -270,7 +271,10 @@ int GUIFileSelector::GetFileList(const std::string folder) mFolderList.push_back(data); } else if (data.fileType == DT_REG || data.fileType == DT_LNK || data.fileType == DT_BLK) { if (mExtn.empty() || (data.fileName.length() > mExtn.length() && data.fileName.substr(data.fileName.length() - mExtn.length()) == mExtn)) { - mFileList.push_back(data); + if (mExtn == ".ab" && twadbbu::Check_ADB_Backup_File(path)) + mFolderList.push_back(data); + else + mFileList.push_back(data); } } } @@ -354,8 +358,8 @@ void GUIFileSelector::NotifySelect(size_t item_selected) cwd += str; } - if (mShowNavFolders == 0 && mShowFiles == 0) { - // nav folders and files are disabled, this is probably the restore list and we need to save chosen location to mVariable instead of mPathVar + if (mShowNavFolders == 0 && (mShowFiles == 0 || mExtn == ".ab")) { + // this is probably the restore list and we need to save chosen location to mVariable instead of mPathVar DataManager::SetValue(mVariable, cwd); } else { // We are changing paths, so we need to set mPathVar -- cgit v1.2.3