diff options
| author | Stefan Hoffmann <stefan991@gmail.com> | 2014-03-16 15:01:22 +0100 |
|---|---|---|
| committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-04-03 10:30:03 -0300 |
| commit | 071d28076f4ee057764359999cf2fabc75e99314 (patch) | |
| tree | 7303724b94d7b70d60aeb2f370736ce2f6d4714f /src/os | |
| parent | 4a138137f78907703aa9215b45f46b8f37d84ae5 (diff) | |
| download | rneovim-071d28076f4ee057764359999cf2fabc75e99314.tar.gz rneovim-071d28076f4ee057764359999cf2fabc75e99314.tar.bz2 rneovim-071d28076f4ee057764359999cf2fabc75e99314.zip | |
move check_file_readonly() into /src/os/fs.c and rename it
Diffstat (limited to 'src/os')
| -rw-r--r-- | src/os/fs.c | 10 | ||||
| -rw-r--r-- | src/os/os.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/os/fs.c b/src/os/fs.c index 711262740e..71dee4dd3d 100644 --- a/src/os/fs.c +++ b/src/os/fs.c @@ -278,3 +278,13 @@ 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 (mch_access(name, W_OK) == 0) { + return FALSE; + } else { + return TRUE; + } +} + diff --git a/src/os/os.h b/src/os/os.h index 6a5bb156cd..e4f5af5057 100644 --- a/src/os/os.h +++ b/src/os/os.h @@ -68,5 +68,6 @@ 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); #endif // NEOVIM_OS_OS_H |