Correct file size calculation
This commit is contained in:
parent
cad4e4ab20
commit
52d042fd48
|
@ -186,13 +186,11 @@ static void addFiles2(std::map<std::string, std::size_t> &files,
|
||||||
if (stat(path.c_str(), &file_stat) != -1) {
|
if (stat(path.c_str(), &file_stat) != -1) {
|
||||||
if ((file_stat.st_mode & S_IFMT) == S_IFDIR) {
|
if ((file_stat.st_mode & S_IFMT) == S_IFDIR) {
|
||||||
DIR * dir = opendir(path.c_str());
|
DIR * dir = opendir(path.c_str());
|
||||||
|
|
||||||
if (!dir)
|
if (!dir)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dirent entry;
|
dirent entry;
|
||||||
dirent * dir_result;
|
dirent * dir_result;
|
||||||
|
|
||||||
std::string new_path;
|
std::string new_path;
|
||||||
new_path.reserve(path.length() + 100);// prealloc some memory to avoid constant new/deletes in loop
|
new_path.reserve(path.length() + 100);// prealloc some memory to avoid constant new/deletes in loop
|
||||||
|
|
||||||
|
@ -210,6 +208,7 @@ static void addFiles2(std::map<std::string, std::size_t> &files,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Path::acceptFile(new_path, extra) && !ignored.match(new_path)) {
|
if (Path::acceptFile(new_path, extra) && !ignored.match(new_path)) {
|
||||||
|
stat(new_path.c_str(), &file_stat);
|
||||||
files[new_path] = file_stat.st_size;
|
files[new_path] = file_stat.st_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue