diff options
author | Carlos Bohórquez <carlos@kernelmap.com> | 2015-09-08 19:50:12 +0200 |
---|---|---|
committer | Carlos Bohórquez <carlos@kernelmap.com> | 2015-09-08 19:50:12 +0200 |
commit | c1e13633ce69cd9047697b645e2914bff145eaaa (patch) | |
tree | 295c5b2040b96ed3d5b7fe4f2a8990f5865acca6 | |
parent | Solves the issue 11073 (diff) | |
download | lumina-c1e13633ce69cd9047697b645e2914bff145eaaa.tar.gz lumina-c1e13633ce69cd9047697b645e2914bff145eaaa.tar.bz2 lumina-c1e13633ce69cd9047697b645e2914bff145eaaa.zip |
Avoid follow symlinks for size information.
Qt follows symlinks in Unix when size function is used. As a result, if
you have several symlinks that points to big files, the information will
be "wrong". It's better to avoid call size on symlinks and lost several
hundred of bytes instead of get the size of the same file several times.
If needed, lstat systemcall can be used to get symlinks real size.
-rw-r--r-- | lumina-fileinfo/MainUI.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lumina-fileinfo/MainUI.cpp b/lumina-fileinfo/MainUI.cpp index b2f0a9a9..481574e0 100644 --- a/lumina-fileinfo/MainUI.cpp +++ b/lumina-fileinfo/MainUI.cpp @@ -153,7 +153,8 @@ void MainUI::GetDirSize(const QString dirname) const { } else ++file_number; - filesize += file_list[i].size(); + if(!file_list[i].isSymLink()) + filesize += file_list[i].size(); } while(!head.isEmpty()) { if(terminate_thread) @@ -171,7 +172,8 @@ void MainUI::GetDirSize(const QString dirname) const { } else ++file_number; - filesize += file_list[i].size(); + if(!file_list[i].isSymLink()) + filesize += file_list[i].size(); if(i%update_frequency == 0) emit folder_size_changed(filesize, file_number, dir_number, false); } |