diff options
Diffstat (limited to '')
-rw-r--r-- | twrp-functions.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/twrp-functions.cpp b/twrp-functions.cpp index eabcc53e1..d7c9c2cab 100644 --- a/twrp-functions.cpp +++ b/twrp-functions.cpp @@ -35,6 +35,7 @@ #include <iostream> #include <fstream> #include <sstream> +#include <cctype> #include <algorithm> #include "twrp-functions.hpp" #include "twcommon.h" @@ -857,6 +858,10 @@ void TWFunc::Auto_Generate_Backup_Name() { DataManager::SetValue(TW_BACKUP_NAME, Get_Current_Date()); return; } + else { + //remove periods from build display so it doesn't confuse the extension code + propvalue.erase(remove(propvalue.begin(), propvalue.end(), '.'), propvalue.end()); + } string Backup_Name = Get_Current_Date(); Backup_Name += "_" + propvalue; if (Backup_Name.size() > MAX_BACKUP_NAME_LEN) @@ -1122,4 +1127,23 @@ void TWFunc::copy_kernel_log(string curr_storage) { gui_msg(Msg("copy_kernel_log=Copied kernel log to {1}")(dmesgDst)); tw_set_default_metadata(dmesgDst.c_str()); } + +bool TWFunc::isNumber(string strtocheck) { + int num = 0; + std::istringstream iss(strtocheck); + + if (!(iss >> num).fail()) + return true; + else + return false; +} + +int TWFunc::stream_adb_backup(string &Restore_Name) { + string cmd = "/sbin/bu --twrp stream " + Restore_Name; + LOGINFO("stream_adb_backup: %s\n", cmd.c_str()); + int ret = TWFunc::Exec_Cmd(cmd); + if (ret != 0) + return -1; + return ret; +} #endif // ndef BUILD_TWRPTAR_MAIN |