mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +00:00
move filewritable() into /src/os/fs.c and rename it
This commit is contained in:

committed by
Thiago de Arruda

parent
071d28076f
commit
f762a9e195
27
src/misc2.c
27
src/misc2.c
@@ -1666,33 +1666,6 @@ void sort_strings(char_u **files, int count)
|
||||
qsort((void *)files, (size_t)count, sizeof(char_u *), sort_compare);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return 0 for not writable, 1 for writable file, 2 for a dir which we have
|
||||
* rights to write into.
|
||||
*/
|
||||
int filewritable(char_u *fname)
|
||||
{
|
||||
int retval = 0;
|
||||
#if defined(UNIX) || defined(VMS)
|
||||
int perm = 0;
|
||||
#endif
|
||||
|
||||
#if defined(UNIX) || defined(VMS)
|
||||
perm = os_getperm(fname);
|
||||
#endif
|
||||
if (
|
||||
# if defined(UNIX) || defined(VMS)
|
||||
(perm & 0222) &&
|
||||
# endif
|
||||
mch_access((char *)fname, W_OK) == 0
|
||||
) {
|
||||
++retval;
|
||||
if (os_isdir(fname))
|
||||
++retval;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print an error message with one or two "%s" and one or two string arguments.
|
||||
* This is not in message.c to avoid a warning for prototypes.
|
||||
|
Reference in New Issue
Block a user