diff options
-rw-r--r-- | src/os/fs.c | 3 | ||||
-rw-r--r-- | src/os/os.h | 14 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/os/fs.c b/src/os/fs.c index fdf9d0795e..84e31502ab 100644 --- a/src/os/fs.c +++ b/src/os/fs.c @@ -278,7 +278,6 @@ int os_file_exists(const char_u *name) } } -// return TRUE if a file appears to be read-only from the file permissions. int os_file_is_readonly(const char *name) { if (access(name, W_OK) == 0) { @@ -288,8 +287,6 @@ int os_file_is_readonly(const char *name) } } -// return 0 for not writable, 1 for writable file, 2 for a dir which we have -// rights to write into. int os_file_is_writable(const char *name) { if (access(name, W_OK) == 0) { diff --git a/src/os/os.h b/src/os/os.h index 8999d1480b..452c053868 100644 --- a/src/os/os.h +++ b/src/os/os.h @@ -60,6 +60,18 @@ int os_setperm(const char_u *name, int perm); /// @return `TRUE` if `name` exists. int os_file_exists(const char_u *name); +/// Check if a file is readonly. +/// +/// @return `True` if `name` is readonly. +int os_file_is_readonly(const char *name); + +/// Check if a file is writable. +/// +/// @return `0` if `name` is not writable, +/// @return `1` if `name` is writable, +/// @return `2` for a directory which we have rights to write into. +int os_file_is_writable(const char *name); + long_u os_total_mem(int special); const char *os_getenv(const char *name); int os_setenv(const char *name, const char *value, int overwrite); @@ -68,7 +80,5 @@ int os_get_usernames(garray_T *usernames); int os_get_user_name(char *s, size_t len); int os_get_uname(uid_t uid, char *s, size_t len); char *os_get_user_directory(const char *name); -int os_file_is_readonly(const char *name); -int os_file_is_writable(const char *name); #endif // NEOVIM_OS_OS_H |