diff --git a/include/ircd/fs/path.h b/include/ircd/fs/path.h index f71e7debd..6cbb78c15 100644 --- a/include/ircd/fs/path.h +++ b/include/ircd/fs/path.h @@ -39,6 +39,7 @@ namespace ircd::fs string_view path(const mutable_buffer &, const vector_view &); string_view path(const mutable_buffer &, const vector_view &); string_view path(const mutable_buffer &, const filesystem::path &); + template 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 +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)...); + }); +}