summaryrefslogtreecommitdiffstats
path: root/twrpDU.cpp
diff options
context:
space:
mode:
authorMatt Mower <mowerm@gmail.com>2014-03-21 02:20:13 +0100
committerMatt Mower <mowerm@gmail.com>2014-03-27 22:19:09 +0100
commit2f1b2ab2234d055977c0cbefcfa06f5a842138b2 (patch)
treea66acfd6772ff3833187e023ce1db9c635a2d9df /twrpDU.cpp
parentRe-arrange handling of settings storage partition (diff)
downloadandroid_bootable_recovery-2f1b2ab2234d055977c0cbefcfa06f5a842138b2.tar
android_bootable_recovery-2f1b2ab2234d055977c0cbefcfa06f5a842138b2.tar.gz
android_bootable_recovery-2f1b2ab2234d055977c0cbefcfa06f5a842138b2.tar.bz2
android_bootable_recovery-2f1b2ab2234d055977c0cbefcfa06f5a842138b2.tar.lz
android_bootable_recovery-2f1b2ab2234d055977c0cbefcfa06f5a842138b2.tar.xz
android_bootable_recovery-2f1b2ab2234d055977c0cbefcfa06f5a842138b2.tar.zst
android_bootable_recovery-2f1b2ab2234d055977c0cbefcfa06f5a842138b2.zip
Diffstat (limited to 'twrpDU.cpp')
-rw-r--r--twrpDU.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/twrpDU.cpp b/twrpDU.cpp
index d2345d768..3047e2b15 100644
--- a/twrpDU.cpp
+++ b/twrpDU.cpp
@@ -67,10 +67,7 @@ uint64_t twrpDU::Get_Folder_Size(const string& Path) {
DIR* d;
struct dirent* de;
struct stat st;
- unsigned long long dusize = 0;
- unsigned long long dutemp = 0;
-
- parent = Path.substr(0, Path.find_last_of('/'));
+ uint64_t dusize = 0;
d = opendir(Path.c_str());
if (d == NULL) {
@@ -79,14 +76,10 @@ uint64_t twrpDU::Get_Folder_Size(const string& Path) {
return 0;
}
- while ((de = readdir(d)) != NULL)
- {
+ while ((de = readdir(d)) != NULL) {
if (de->d_type == DT_DIR && !check_skip_dirs(Path, de->d_name)) {
- dutemp = Get_Folder_Size((Path + "/" + de->d_name));
- dusize += dutemp;
- dutemp = 0;
- }
- else if (de->d_type == DT_REG) {
+ dusize += Get_Folder_Size(Path + "/" + de->d_name);
+ } else if (de->d_type == DT_REG) {
stat((Path + "/" + de->d_name).c_str(), &st);
dusize += (uint64_t)(st.st_size);
}