#ifndef _SK_UTIL_FS_H #define _SK_UTIL_FS_H #include #include #include #include #include #include #if HAVE_STDBOOL_H #include #endif /** * exists: * Check if a given pathname exists. * * @param pathname: the path to check * @return true if @pathname exists, false otherwise. */ #define exists(pathname) (0 == access(pathname, F_OK)) /** * is_dir: * Check if a given pathname is a directory. * * @param pathname: the path to check * @return true if @pathname exists and is a directory, false otherwise. */ bool is_dir(const char *restrict pathname); /** * myhome: * Returns a pointer to a string containing the current user’s home * directory. * The returned pointer points to a static location (don’t free() it) and * may be changed on future invocations. * * This function makes sure that the returned string is null-terminated and * truncates the result to fit within PATH_MAX if necessary. * * @returns home dir */ const char *myhome(); #endif