This commit is contained in:
Erik Frojdh
2021-03-31 16:26:36 +02:00
parent fa25340e5c
commit 01c785271f
9 changed files with 71 additions and 74 deletions

View File

@ -3,6 +3,7 @@
#include "sls/sls_detector_exceptions.h"
#include <errno.h>
#include <ios>
#include <iostream>
#include <sstream>
#include <sys/stat.h>
@ -92,3 +93,13 @@ void mkdir_p(const std::string &path, std::string dir) {
if (i + 1 < path.length())
mkdir_p(path.substr(i + 1), dir);
}
namespace sls {
int getFileSize(std::ifstream &ifs) {
auto current_pos = ifs.tellg();
ifs.seekg(0, std::ios::end);
int file_size = ifs.tellg();
ifs.seekg(current_pos);
return file_size;
}
} // namespace sls