0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 08:12:37 +01:00

ircd::fs::path: Translate boost exceptions coming out of tool impls.

This commit is contained in:
Jason Volk 2020-11-15 07:42:14 -08:00
parent f558c05483
commit 119f5a88fc

View file

@ -219,62 +219,110 @@ ircd::fs::base::db
ircd::string_view
ircd::fs::canonical(const mutable_buffer &buf,
const string_view &p)
try
{
return path(buf, canonical(_path(p)));
}
catch(const filesystem::filesystem_error &e)
{
throw error
{
e, "%s",
rsplit(e.what(), ':').second,
};
}
ircd::string_view
ircd::fs::canonical(const mutable_buffer &buf,
const string_view &root,
const string_view &p)
try
{
return path(buf, canonical(_path(p), _path(root)));
}
catch(const filesystem::filesystem_error &e)
{
throw error
{
e, "%s",
rsplit(e.what(), ':').second,
};
}
ircd::string_view
ircd::fs::relative(const mutable_buffer &buf,
const string_view &root,
const string_view &p)
try
{
return path(buf, relative(_path(p), _path(root)));
}
catch(const filesystem::filesystem_error &e)
{
throw error{e};
}
ircd::string_view
ircd::fs::absolute(const mutable_buffer &buf,
const string_view &root,
const string_view &p)
try
{
return path(buf, absolute(_path(p), _path(root)));
}
catch(const filesystem::filesystem_error &e)
{
throw error{e};
}
ircd::string_view
ircd::fs::parent(const mutable_buffer &buf,
const string_view &p)
try
{
return path(buf, _path(p).parent_path());
}
catch(const filesystem::filesystem_error &e)
{
throw error{e};
}
ircd::string_view
ircd::fs::filename(const mutable_buffer &buf,
const string_view &p)
try
{
return path(buf, _path(p).filename());
}
catch(const filesystem::filesystem_error &e)
{
throw error{e};
}
ircd::string_view
ircd::fs::extension(const mutable_buffer &buf,
const string_view &p)
try
{
return path(buf, _path(p).extension());
}
catch(const filesystem::filesystem_error &e)
{
throw error{e};
}
ircd::string_view
ircd::fs::extension(const mutable_buffer &buf,
const string_view &p,
const string_view &replace)
try
{
return path(buf, _path(p).replace_extension(_path(replace)));
}
catch(const filesystem::filesystem_error &e)
{
throw error{e};
}
bool
ircd::fs::is_relative(const string_view &p)