From 8f09fa1a49ffa1fc00eabf78c54908d515d0aaa5 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 16 Aug 2015 23:13:55 -0400 Subject: os/fs.c: remove os_file_is_readonly() os_file_is_readonly() in its current form is equivalent to !os_file_is_writable(). This does not appear to be a bug, because Vim's use of check_file_readonly() (which we changed to os_file_is_readonly()) is equivalent to !os_file_is_writable() in every case. os_file_is_readonly() also fails this test: returns false if the file is non-read, non-write A more useful form would define behavior under these cases: - path is executable (but not writable) - path is non-existent - path is directory But there is no reason for os_file_is_readonly() to exist, so remove it. --- src/nvim/os/fs.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/nvim/os') diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index e4776999e5..785c79127f 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -270,15 +270,6 @@ bool os_file_exists(const char_u *name) return os_stat((char *)name, &statbuf); } -/// Check if a file is readonly. -/// -/// @return `true` if `name` is readonly. -bool os_file_is_readonly(const char *name) - FUNC_ATTR_NONNULL_ALL -{ - return access(name, W_OK) != 0; -} - /// Check if a file is readable. /// /// @return true if `name` is readable, otherwise false. -- cgit