0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd::fs: Add is_exec() to interface.

This commit is contained in:
Jason Volk 2020-10-19 22:22:33 -07:00
parent 5c8c12dd06
commit e5b0fe25c7
2 changed files with 12 additions and 0 deletions

View file

@ -64,6 +64,7 @@ namespace ircd::fs
bool exists(const string_view &path);
bool is_dir(const string_view &path);
bool is_reg(const string_view &path);
bool is_exec(const string_view &path);
size_t size(const string_view &path);
std::vector<std::string> ls(const string_view &path);
std::vector<std::string> ls_r(const string_view &path);

View file

@ -514,6 +514,17 @@ catch(const filesystem::filesystem_error &e)
throw error{e};
}
bool
ircd::fs::is_exec(const string_view &path)
try
{
return filesystem::status(_path(path)).permissions() & filesystem::owner_exe;
}
catch(const filesystem::filesystem_error &e)
{
throw error{e};
}
bool
ircd::fs::is_reg(const string_view &path)
try