aboutsummaryrefslogtreecommitdiff
path: root/fileio.c
diff options
context:
space:
mode:
Diffstat (limited to 'fileio.c')
-rw-r--r--fileio.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fileio.c b/fileio.c
index 18a0025..1ab1205 100644
--- a/fileio.c
+++ b/fileio.c
@@ -386,8 +386,6 @@ void move(void) {
//
// Recursive Dir Size
//
-// NOTE: will not count directories starting with . (dot)
-// so size of git repo will not be included
off_t du(char *pdir) {
DIR *dir;
struct dirent *direntry;
@@ -405,10 +403,17 @@ off_t du(char *pdir) {
while(direntry) {
snprintf(child, PHYS_DIRNAME_SIZE, "%s/%s", pdir, direntry->d_name);
if(lstat(child, &fileinfo)==0) {
- if(S_ISDIR(fileinfo.st_mode) && (direntry->d_name[0]!='.')) //TODO: count other ".files" except . & ..
- tot+=du(child);
- else
+ if(S_ISDIR(fileinfo.st_mode)) {
+ if(direntry->d_name[0]=='.' && direntry->d_name[1]=='\0')
+ ;
+ else if(direntry->d_name[0]=='.' && direntry->d_name[1]=='.' && direntry->d_name[2]=='\0')
+ ;
+ else
+ tot+=du(child);
+ }
+ else {
tot+=fileinfo.st_size;
+ }
}
direntry=readdir(dir);
}