diff options
Diffstat (limited to '')
-rw-r--r-- | partition.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/partition.cpp b/partition.cpp index 061a3e189..31b1bfdb3 100644 --- a/partition.cpp +++ b/partition.cpp @@ -1,5 +1,5 @@ /* - Copyright 2012 bigbiff/Dees_Troy TeamWin + Copyright 2013 TeamWin This file is part of TWRP/TeamWin Recovery Project. TWRP is free software: you can redistribute it and/or modify @@ -39,6 +39,7 @@ #include "twrp-functions.hpp" #include "twrpDigest.hpp" #include "twrpTar.hpp" +#include "twrpDU.hpp" extern "C" { #include "mtdutils/mtdutils.h" #include "mtdutils/mounts.h" @@ -811,7 +812,7 @@ bool TWPartition::Find_Partition_Size(void) { sscanf(line, "%s %lx %*lx %*lu %s", label, &size, device); - // Skip header, annotation and blank lines + // Skip header, annotation and blank lines if ((strncmp(device, "/dev/", 5) != 0) || (strlen(line) < 8)) continue; @@ -1514,7 +1515,7 @@ bool TWPartition::Wipe_Data_Without_Wiping_Media() { if (d != NULL) { struct dirent* de; while ((de = readdir(d)) != NULL) { - if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0) continue; + if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0) continue; // The media folder is the "internal sdcard" // The .layout_version file is responsible for determining whether 4.2 decides up upgrade // the media folder for multi-user. @@ -1555,7 +1556,10 @@ bool TWPartition::Backup_Tar(string backup_folder) { DataManager::GetValue(TW_USE_COMPRESSION_VAR, use_compression); tar.use_compression = use_compression; //exclude Google Music Cache - tar.setexcl("/data/data/com.google.android.music/files"); + vector<string> excludedirs = du.get_absolute_dirs(); + for (int i = 0; i < excludedirs.size(); ++i) { + tar.setexcl(excludedirs.at(i)); + } #ifndef TW_EXCLUDE_ENCRYPTED_BACKUPS DataManager::GetValue("tw_encrypt_backup", use_encryption); if (use_encryption && Can_Encrypt_Backup) { @@ -1772,16 +1776,12 @@ bool TWPartition::Update_Size(bool Display_Error) { if (Has_Data_Media) { if (Mount(Display_Error)) { unsigned long long data_media_used, actual_data; - Used = TWFunc::Get_Folder_Size("/data", Display_Error); - data_media_used = TWFunc::Get_Folder_Size("/data/media", Display_Error); - actual_data = Used - data_media_used; - Backup_Size = actual_data; - int bak = (int)(Backup_Size / 1048576LLU); - int total = (int)(Size / 1048576LLU); - int us = (int)(Used / 1048576LLU); + du.add_relative_dir("media"); + Used = du.Get_Folder_Size("/data"); + Backup_Size = Used; + int bak = (int)(Used / 1048576LLU); int fre = (int)(Free / 1048576LLU); - int datmed = (int)(data_media_used / 1048576LLU); - LOGINFO("Data backup size is %iMB, size: %iMB, used: %iMB, free: %iMB, in data/media: %iMB.\n", bak, total, us, fre, datmed); + LOGINFO("Data backup size is %iMB, free: %iMB.\n", bak, fre); } else { if (!Was_Already_Mounted) UnMount(false); @@ -1789,7 +1789,7 @@ bool TWPartition::Update_Size(bool Display_Error) { } } else if (Has_Android_Secure) { if (Mount(Display_Error)) - Backup_Size = TWFunc::Get_Folder_Size(Backup_Path, Display_Error); + Backup_Size = du.Get_Folder_Size(Backup_Path); else { if (!Was_Already_Mounted) UnMount(false); |