29 lines
558 B
C++
29 lines
558 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <filesystem>
|
|
#include <optional>
|
|
#include <stop_token>
|
|
|
|
namespace ks::files
|
|
{
|
|
struct FolderSize
|
|
{
|
|
uint64_t bytes{};
|
|
bool partial{}, failed{}, previous{};
|
|
|
|
void add(uint64_t amount)
|
|
{
|
|
if(amount>UINT64_MAX-bytes)
|
|
{
|
|
bytes=UINT64_MAX;
|
|
partial=true;
|
|
}
|
|
else bytes+=amount;
|
|
}
|
|
};
|
|
|
|
// No result means the caller should use its ordinary directory listing.
|
|
std::optional<FolderSize> measureNtfsFolder(const std::filesystem::path &,std::stop_token);
|
|
}
|