28 #ifndef LIB_STAT_FILE_H 29 #define LIB_STAT_FILE_H 43 extern const string UNIX_HOMEDIR_SYMBOL;
50 auto home = std::getenv(UNIX_HOMEDIR_ENV);
53 return fs::path{home};
65 if (UNIX_HOMEDIR_SYMBOL == *rawPath.begin())
66 rawPath = getHomePath() / rawPath.lexically_proximate(UNIX_HOMEDIR_SYMBOL);
68 return fs::exists(rawPath)? fs::absolute(
69 fs::canonical(rawPath))
76 has_perm (fs::path
const& p, fs::perms permissionMask)
78 return (fs::status(p).permissions() & permissionMask) == permissionMask;
85 return has_perm (p, fs::perms::owner_read);
89 can_write (fs::path
const& p)
91 return has_perm (p, fs::perms::owner_write);
95 can_exec (fs::path
const& p)
97 return has_perm (p, fs::perms::owner_exec);
110 invoke (fs::path path) noexcept
112 return "≺"+std::string{path}+
"≻";
115 {
return lib::meta::FAILURE_INDICATOR; }
fs::path consolidated(fs::path rawPath)
resolves symlinks, ~ (Unix home dir) and relative specs
bool has_perm(fs::path const &p, fs::perms permissionMask)
check if the denoted path p has at least the given permissions
inline string literal This is a marker type to indicate that
bool can_read(fs::path const &p)
check if the owner has read permissions on the denoted file or directory
Derived specific exceptions within Lumiera's exception hierarchy.
Marker types to indicate a literal string and a Symbol.
Lumiera error handling (C++ interface).
failsafe invocation of custom string conversion.