mirror of
https://github.com/matrix-construct/construct
synced 2024-11-15 14:31:11 +01:00
ircd::fs: Add is_exec() to interface.
This commit is contained in:
parent
5c8c12dd06
commit
e5b0fe25c7
2 changed files with 12 additions and 0 deletions
|
@ -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);
|
||||
|
|
11
ircd/fs.cc
11
ircd/fs.cc
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue