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

Functions

bool IsNeighbour (const std::filesystem::path &in_rPathA, const std::filesystem::path &in_rPathB)
template<typename T>
std::error_code TruncateFiles (const std::filesystem::path &in_rPath, std::string_view in_extension, size_t in_max, T &&in_rrCompare)
std::error_code TruncateFilesByAge (const std::filesystem::path &in_rPath, std::string_view in_extension, size_t in_max)
std::filesystem::path FindInEnvironment (const std::filesystem::path &in_rFileName)

Function Documentation

◆ FindInEnvironment()

std::filesystem::path hedgedev::csl::ut::filesystem::FindInEnvironment ( const std::filesystem::path & in_rFileName)
inline

Finds a file in the system environment.

Parameters
in_rFileNameThe file to search for.
Returns
If found, the path to the file. Otherwise, an empty path.

◆ IsNeighbour()

bool hedgedev::csl::ut::filesystem::IsNeighbour ( const std::filesystem::path & in_rPathA,
const std::filesystem::path & in_rPathB )
inline

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

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

◆ TruncateFiles()

template<typename T>
std::error_code hedgedev::csl::ut::filesystem::TruncateFiles ( const std::filesystem::path & in_rPath,
std::string_view in_extension,
size_t in_max,
T && in_rrCompare )
inline

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

Parameters
in_rPathThe 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_rrCompareThe comparison method that determines how the files to be truncated should be sorted.

◆ TruncateFilesByAge()

std::error_code hedgedev::csl::ut::filesystem::TruncateFilesByAge ( const std::filesystem::path & in_rPath,
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_rPathThe 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.