CommonLib
Loading...
Searching...
No Matches
hedgedev::csl::ut::filesystem Namespace Reference

Functions

bool is_neighbour (const std::filesystem::path &in_left, const std::filesystem::path &in_right)
template<typename T>
std::error_code truncate_files (const std::filesystem::path &in_path, std::string_view in_extension, size_t in_max, T &&in_compare_func)
std::error_code truncate_files_by_age (const std::filesystem::path &in_path, std::string_view in_extension, size_t in_max=10)

Function Documentation

◆ is_neighbour()

bool hedgedev::csl::ut::filesystem::is_neighbour ( const std::filesystem::path & in_left,
const std::filesystem::path & in_right )
inline

Checks if a path is in the same directory as another.

Parameters
in_leftThe first path.
in_rightThe second path.
Returns
true if both paths are in the same directory. Otherwise, false.

◆ truncate_files()

template<typename T>
std::error_code hedgedev::csl::ut::filesystem::truncate_files ( const std::filesystem::path & in_path,
std::string_view in_extension,
size_t in_max,
T && in_compare_func )
inline

Truncates specific file types in a directory down to a maximum number of files.

Parameters
in_pathThe directory containing the files to truncate.
in_extensionThe extension of the files to truncate.
in_maxThe maximum number of files of the specified type that can exist in this directory.
in_compare_funcThe comparison method that determines how the files to be truncated should be sorted.

◆ truncate_files_by_age()

std::error_code hedgedev::csl::ut::filesystem::truncate_files_by_age ( const std::filesystem::path & in_path,
std::string_view in_extension,
size_t in_max = 10 )
inline

Truncates specific file types in a directory down to a maximum number of files, sorted by age.

Parameters
in_pathThe directory containing the files to truncate.
in_extensionThe extension of the files to truncate.
in_maxThe maximum number of files of the specified type that can exist in this directory.