From 1b7a31bd65d4e6bf5e337d6280e3d5319d460bef Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Thu, 3 Jul 2014 15:09:22 -0500 Subject: Track backup and restore progress Track backup and restore progress based on the sizes of the files as they are being added to the tar backup file. Update the progress bar based on the sizes of the files. Change-Id: Idf649efa1db3e91830b4b2add86203a3f30042ff --- twrp-functions.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'twrp-functions.cpp') diff --git a/twrp-functions.cpp b/twrp-functions.cpp index 2128c9635..db98a363a 100644 --- a/twrp-functions.cpp +++ b/twrp-functions.cpp @@ -299,6 +299,30 @@ std::string TWFunc::Remove_Trailing_Slashes(const std::string& path, bool leaveL return res; } +vector TWFunc::split_string(const string &in, char del, bool skip_empty) { + vector res; + + if (in.empty() || del == '\0') + return res; + + string field; + istringstream f(in); + if (del == '\n') { + while(getline(f, field)) { + if (field.empty() && skip_empty) + continue; + res.push_back(field); + } + } else { + while(getline(f, field, del)) { + if (field.empty() && skip_empty) + continue; + res.push_back(field); + } + } + return res; +} + #ifndef BUILD_TWRPTAR_MAIN // Returns "/path" from a full /path/to/file.name -- cgit v1.2.3