From 3fdcda46629e8e7fc19e89c51350b1e6f151e05e Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Wed, 30 Nov 2016 12:29:37 -0600 Subject: Improve backup & wipe exclusion handling Rename twrpDU.* to exclude.* Remove global variable for du and replace with partition specific variables. Use separate exclusion lists for backups and wiping. Clean up some includes Fix some parenthesis in twrp.cpp that I messed up. Note: twrpTarMain command line utility compiles but probably does not work correctly yet due to not properly setting part_settings Change-Id: Idec9c3e6a8782ba53f3420fa79ba33394f4f85fb --- twrpTarMain/twrpTarMain.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'twrpTarMain/twrpTarMain.cpp') diff --git a/twrpTarMain/twrpTarMain.cpp b/twrpTarMain/twrpTarMain.cpp index ff35f47ce..df40426e4 100644 --- a/twrpTarMain/twrpTarMain.cpp +++ b/twrpTarMain/twrpTarMain.cpp @@ -19,14 +19,12 @@ #include "../twrp-functions.hpp" #include "../twrpTar.hpp" -#include "../twrpDU.hpp" +#include "../exclude.hpp" #include "../progresstracking.hpp" #include "../gui/gui.hpp" #include "../gui/twmsg.h" #include -twrpDU du; - void gui_msg(const char* text) { if (text) { @@ -166,11 +164,14 @@ int main(int argc, char **argv) { } } + TWExclude exclude; + exclude.add_absolute_dir("/data/media"); tar.has_data_media = has_data_media; tar.setdir(Directory); tar.setfn(Tar_Filename); - tar.setsize(du.Get_Folder_Size(Directory)); + tar.setsize(exclude.Get_Folder_Size(Directory)); tar.use_compression = use_compression; + tar.backup_exclusions = &exclude; #ifndef TW_EXCLUDE_ENCRYPTED_BACKUPS if (userdata_encryption && !use_encryption) { printf("userdata encryption set without encryption option\n"); @@ -186,14 +187,14 @@ int main(int argc, char **argv) { } #endif if (action == 1) { - if (tar.createTarFork(&progress, tar_fork_pid) != 0) { + if (tar.createTarFork(&tar_fork_pid) != 0) { sync(); return -1; } sync(); printf("\n\ntar created successfully.\n"); } else if (action == 2) { - if (tar.extractTarFork(&progress) != 0) { + if (tar.extractTarFork() != 0) { sync(); return -1; } -- cgit v1.2.3