Skip to content

Commit 2df8993

Browse files
author
Andrei Popescu
authored
Fix utils::Dir::Size() issue on missing filter. (#1364)
When filter was not passed to the olp::utils::Dir::Size() method than all files were filtered out resulting always in 0 size returned back. This is not fixed. Relates-To: OLPEDGE-2700 Signed-off-by: Andrei Popescu <andrei.popescu@here.com> Signed-off-by: Andrei Popescu <andrei.popescu@here.com>
1 parent a3bdc67 commit 2df8993

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

olp-cpp-sdk-core/src/utils/Dir.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ uint64_t Dir::Size(const std::string& path, FilterFunction filter_fn) {
465465
if (::lstat64(full_path.c_str(), &path_stat) == 0) {
466466
#endif
467467
if (S_ISREG(path_stat.st_mode)) {
468-
if (filter_fn && filter_fn(entry_name)) {
468+
if (!filter_fn || filter_fn(entry_name)) {
469469
result += path_stat.st_size;
470470
}
471471
} else if (S_ISDIR(path_stat.st_mode)) {

0 commit comments

Comments
 (0)