mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
ircd::fs::path: Add canonical() suite to interface; minor reorg.
This commit is contained in:
parent
bb7cda6fec
commit
cb223b97c0
2 changed files with 26 additions and 9 deletions
|
@ -46,8 +46,10 @@ namespace ircd::fs
|
|||
|
||||
string_view extension(const mutable_buffer &, const string_view &path, const string_view &replace);
|
||||
string_view extension(const mutable_buffer &, const string_view &path);
|
||||
string_view relative(const mutable_buffer &, const string_view &root, const string_view &path);
|
||||
string_view filename(const mutable_buffer &, const string_view &path);
|
||||
string_view relative(const mutable_buffer &, const string_view &root, const string_view &path);
|
||||
string_view canonical(const mutable_buffer &, const string_view &path);
|
||||
string_view canonical(const mutable_buffer &, const string_view &root, const string_view &path);
|
||||
string_view parent(const mutable_buffer &, const string_view &path);
|
||||
|
||||
long pathconf(const string_view &path, const int &arg);
|
||||
|
|
|
@ -287,6 +287,29 @@ ircd::fs::pathconf(const string_view &path,
|
|||
return syscall(::pathconf, path_cstr(path), arg);
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::fs::canonical(const mutable_buffer &buf,
|
||||
const string_view &p)
|
||||
{
|
||||
return path(buf, canonical(_path(p)));
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::fs::canonical(const mutable_buffer &buf,
|
||||
const string_view &root,
|
||||
const string_view &p)
|
||||
{
|
||||
return path(buf, canonical(_path(p), _path(root)));
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::fs::relative(const mutable_buffer &buf,
|
||||
const string_view &root,
|
||||
const string_view &p)
|
||||
{
|
||||
return path(buf, relative(_path(p), _path(root)));
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::fs::filename(const mutable_buffer &buf,
|
||||
const string_view &p)
|
||||
|
@ -309,14 +332,6 @@ ircd::fs::extension(const mutable_buffer &buf,
|
|||
return path(buf, _path(p).replace_extension(_path(replace)));
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::fs::relative(const mutable_buffer &buf,
|
||||
const string_view &root,
|
||||
const string_view &p)
|
||||
{
|
||||
return path(buf, relative(_path(p), _path(root)));
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::fs::is_relative(const string_view &p)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue