diff --git a/include/ircd/fs/path.h b/include/ircd/fs/path.h index 54a3e34af..84370b2fb 100644 --- a/include/ircd/fs/path.h +++ b/include/ircd/fs/path.h @@ -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); diff --git a/ircd/fs_path.cc b/ircd/fs_path.cc index 005ed022c..a8f74c7d4 100644 --- a/ircd/fs_path.cc +++ b/ircd/fs_path.cc @@ -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) {