CommonLib
Loading...
Searching...
No Matches
filesystem.h
Go to the documentation of this file.
1#pragma once
2
3#include <filesystem>
4
5namespace hedgedev::csl::ut::filesystem
6{
7 ///
8 /// Checks if a path is in the same directory as another.
9 ///
10 /// \param in_left The first path.
11 /// \param in_right The second path.
12 ///
13 /// \returns `true` if both paths are in the same directory. Otherwise, `false`.
14 ///
15 inline bool is_neighbour(const std::filesystem::path& in_left, const std::filesystem::path& in_right);
16
17 ///
18 /// Truncates specific file types in a directory down to a maximum number of files.
19 ///
20 /// \param in_path The directory containing the files to truncate.
21 /// \param in_extension The extension of the files to truncate.
22 /// \param in_max The maximum number of files of the specified type that
23 /// can exist in this directory.
24 /// \param in_compare_func The comparison method that determines how the files to be
25 /// truncated should be sorted.
26 ///
27 template <typename T>
29
30 ///
31 /// Truncates specific file types in a directory down to a maximum number of files,
32 /// sorted by age.
33 ///
34 /// \param in_path The directory containing the files to truncate.
35 /// \param in_extension The extension of the files to truncate.
36 /// \param in_max The maximum number of files of the specified type that can
37 /// exist in this directory.
38 ///
40}
41
42#include "filesystem.inl"
43
44__CMNLIB_INTERNAL_MAKE_NAMESPACE_ALIAS(hedgedev::csl::ut, filesystem, fs);
Definition this_process_win32.inl:13
std::filesystem::path get_executable_root()
Definition this_process.inl:7
bool is_neighbour(const std::filesystem::path &in_path)
Definition this_process.inl:12
Definition filesystem.h:6
std::error_code truncate_files_by_age(const std::filesystem::path &in_path, std::string_view in_extension, size_t in_max=10)
Definition filesystem.inl:46
bool is_neighbour(const std::filesystem::path &in_left, const std::filesystem::path &in_right)
Definition filesystem.inl:7
std::error_code truncate_files(const std::filesystem::path &in_path, std::string_view in_extension, size_t in_max, T &&in_compare_func)
Definition filesystem.inl:13