0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-30 12:48:54 +02:00

ircd::fs: Add path string convenience templates.

This commit is contained in:
Jason Volk 2019-02-07 18:03:40 -08:00
parent 7b67b106b6
commit 8206aa1ab9

View file

@ -39,6 +39,7 @@ namespace ircd::fs
string_view path(const mutable_buffer &, const vector_view<const string_view> &);
string_view path(const mutable_buffer &, const vector_view<const std::string> &);
string_view path(const mutable_buffer &, const filesystem::path &);
template<class... A> std::string path_string(A&&...);
bool is_relative(const string_view &path);
bool is_absolute(const string_view &path);
@ -83,3 +84,19 @@ enum ircd::fs::base
_NUM_
};
template<class... A>
std::string
ircd::fs::path_string(A&&... a)
{
static const size_t size
{
PATH_MAX_LEN | SHRINK_TO_FIT
};
return util::string(size, [&a...]
(const mutable_buffer &buf)
{
return path(buf, std::forward<A>(a)...);
});
}