CommonLib
Toggle main menu visibility
Loading...
Searching...
No Matches
filesystem.h
Go to the documentation of this file.
1
#
pragma
once
2
3
#
include
<
filesystem
>
4
5
namespace
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>
28
inline
std
::
error_code
truncate_files
(
const
std
::
filesystem
::
path
&
in_path
,
std
::
string_view
in_extension
,
size_t
in_max
,
T
&&
in_compare_func
);
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
///
39
inline
std
::
error_code
truncate_files_by_age
(
const
std
::
filesystem
::
path
&
in_path
,
std
::
string_view
in_extension
,
size_t
in_max
= 10);
40
}
41
42
#
include
"filesystem.inl"
43
44
__CMNLIB_INTERNAL_MAKE_NAMESPACE_ALIAS(hedgedev::csl::ut, filesystem, fs);
hedgedev::csl::diag::this_process
Definition
this_process_win32.inl:13
hedgedev::csl::diag::this_process::get_executable_root
std::filesystem::path get_executable_root()
Definition
this_process.inl:7
hedgedev::csl::diag::this_process::is_neighbour
bool is_neighbour(const std::filesystem::path &in_path)
Definition
this_process.inl:12
hedgedev::csl::ut::filesystem
Definition
filesystem.h:6
hedgedev::csl::ut::filesystem::truncate_files_by_age
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
hedgedev::csl::ut::filesystem::is_neighbour
bool is_neighbour(const std::filesystem::path &in_left, const std::filesystem::path &in_right)
Definition
filesystem.inl:7
hedgedev::csl::ut::filesystem::truncate_files
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
include
ut
filesystem.h
Generated by
1.18.0