0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 15:30:52 +01:00

ircd::fs: Add interface to filesystem::relative() function.

This commit is contained in:
Jason Volk 2019-02-07 20:22:55 -08:00
parent 8206aa1ab9
commit db552e2ec4
2 changed files with 9 additions and 0 deletions

View file

@ -46,6 +46,7 @@ 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, const string_view &replace);
string_view extension(const mutable_buffer &, const string_view &path); 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 filename(const mutable_buffer &, const string_view &path);
string_view parent(const mutable_buffer &, const string_view &path); string_view parent(const mutable_buffer &, const string_view &path);

View file

@ -1445,6 +1445,14 @@ ircd::fs::extension(const mutable_buffer &buf,
return path(buf, _path(p).replace_extension(_path(replace))); 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 bool
ircd::fs::is_relative(const string_view &p) ircd::fs::is_relative(const string_view &p)
{ {