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:
parent
85cbc76de4
commit
c4c68e3b5c
3 changed files with 11 additions and 2 deletions
|
@ -59,6 +59,7 @@ namespace fastf {
|
||||||
st.is_symlink = parSymlink;
|
st.is_symlink = parSymlink;
|
||||||
st.atime = parStat->st_atime;
|
st.atime = parStat->st_atime;
|
||||||
st.mtime = parStat->st_mtime;
|
st.mtime = parStat->st_mtime;
|
||||||
|
st.size = 0;
|
||||||
|
|
||||||
if (not (*g_searchOptions.callback)(parPath, st))
|
if (not (*g_searchOptions.callback)(parPath, st))
|
||||||
return FTW_STOP;
|
return FTW_STOP;
|
||||||
|
@ -81,6 +82,7 @@ namespace fastf {
|
||||||
st.is_symlink = parSymlink;
|
st.is_symlink = parSymlink;
|
||||||
st.atime = parStat->st_atime;
|
st.atime = parStat->st_atime;
|
||||||
st.mtime = parStat->st_mtime;
|
st.mtime = parStat->st_mtime;
|
||||||
|
st.size = parStat->st_size;
|
||||||
|
|
||||||
if (extensions.empty()) {
|
if (extensions.empty()) {
|
||||||
if (not (*g_searchOptions.callback)(parPath, st)) {
|
if (not (*g_searchOptions.callback)(parPath, st)) {
|
||||||
|
|
|
@ -19,12 +19,16 @@
|
||||||
#define id4A7D7AB671954418939FC0BDA19C5B3F
|
#define id4A7D7AB671954418939FC0BDA19C5B3F
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
namespace fastf {
|
namespace fastf {
|
||||||
struct FileStats {
|
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 atime;
|
||||||
std::time_t mtime;
|
std::time_t mtime;
|
||||||
|
uint64_t size;
|
||||||
|
uint16_t level;
|
||||||
bool is_dir;
|
bool is_dir;
|
||||||
bool is_symlink;
|
bool is_symlink;
|
||||||
};
|
};
|
||||||
|
|
|
@ -92,7 +92,10 @@ int main (int parArgc, char* parArgv[]) {
|
||||||
|
|
||||||
const auto& hashes = filerecdata->get_or_create();
|
const auto& hashes = filerecdata->get_or_create();
|
||||||
for (const auto& hash : hashes) {
|
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;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue