1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2025-07-03 14:14:11 +00:00

Take file size in filesearcher.

Like this the filesize task I was about to write becomes
unnecessary.
This commit is contained in:
King_DuckZ 2016-03-09 18:55:03 +01:00
parent 85cbc76de4
commit c4c68e3b5c
3 changed files with 11 additions and 2 deletions

View file

@ -59,6 +59,7 @@ namespace fastf {
st.is_symlink = parSymlink;
st.atime = parStat->st_atime;
st.mtime = parStat->st_mtime;
st.size = 0;
if (not (*g_searchOptions.callback)(parPath, st))
return FTW_STOP;
@ -81,6 +82,7 @@ namespace fastf {
st.is_symlink = parSymlink;
st.atime = parStat->st_atime;
st.mtime = parStat->st_mtime;
st.size = parStat->st_size;
if (extensions.empty()) {
if (not (*g_searchOptions.callback)(parPath, st)) {

View file

@ -19,12 +19,16 @@
#define id4A7D7AB671954418939FC0BDA19C5B3F
#include <ctime>
#include <cstdint>
namespace fastf {
struct FileStats {
int level;
static_assert(sizeof(std::time_t) >= sizeof(uint64_t), "Reorder members or comment out this assertion");
std::time_t atime;
std::time_t mtime;
uint64_t size;
uint16_t level;
bool is_dir;
bool is_symlink;
};

View file

@ -92,7 +92,10 @@ int main (int parArgc, char* parArgv[]) {
const auto& hashes = filerecdata->get_or_create();
for (const auto& hash : hashes) {
std::cout << '"' << hash.path << "\" -> " << mchlib::tiger_to_string(hash.hash) << " mime: " << hash.mime_type << "\n";
std::cout << '"' << hash.path <<
"\" -> " << mchlib::tiger_to_string(hash.hash) <<
" size: " << hash.size <<
" mime: " << hash.mime_type << "\n";
}
return 0;