0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-02-18 01:30:12 +01:00

ircd::fs: Add function to build path.

This commit is contained in:
Jason Volk 2016-09-23 18:44:30 -07:00
parent 0913873b30
commit 6d2d5a71f5
2 changed files with 12 additions and 0 deletions

View file

@ -86,6 +86,8 @@ enum index
const char *get(index) noexcept;
const char *name(index) noexcept;
std::string build(const std::initializer_list<std::string> &);
bool exists(const std::string &path);
bool is_dir(const std::string &path);
bool is_reg(const std::string &path);

View file

@ -156,6 +156,16 @@ catch(const fs::filesystem_error &e)
throw filesystem_error("%s", e.what());
}
std::string
ircd::path::build(const std::initializer_list<std::string> &list)
{
fs::path ret;
for(const auto &s : list)
ret /= fs::path(s);
return ret.string();
}
const char *
ircd::path::get(index index)
noexcept try