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:
parent
0913873b30
commit
6d2d5a71f5
2 changed files with 12 additions and 0 deletions
|
@ -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);
|
||||
|
|
10
ircd/fs.cc
10
ircd/fs.cc
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue