diff --git a/include/ircd/fs/fs.h b/include/ircd/fs/fs.h index eaba1f1f0..6183c2523 100644 --- a/include/ircd/fs/fs.h +++ b/include/ircd/fs/fs.h @@ -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 ls(const string_view &path); std::vector ls_r(const string_view &path); diff --git a/ircd/fs.cc b/ircd/fs.cc index f0d118ec5..05e8b3c01 100644 --- a/ircd/fs.cc +++ b/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