0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 9.0.0028: MS-Windows: tests fail if there is a "runtime" directory

Problem:    MS-Windows: tests fail if there is a stray "runtime" directory.
Solution:   Only use a "runtime" directory if it contains "defaults.vim".
This commit is contained in:
Bram Moolenaar
2022-07-02 17:36:31 +01:00
parent 2d29501982
commit 022f9ef16c
3 changed files with 37 additions and 21 deletions

View File

@@ -774,6 +774,26 @@ shorten_dir(char_u *str)
shorten_dir_len(str, 1);
}
/*
* Return TRUE if "fname" is a readable file.
*/
int
file_is_readable(char_u *fname)
{
int fd;
#ifndef O_NONBLOCK
# define O_NONBLOCK 0
#endif
if (*fname && !mch_isdir(fname)
&& (fd = mch_open((char *)fname, O_RDONLY | O_NONBLOCK, 0)) >= 0)
{
close(fd);
return TRUE;
}
return FALSE;
}
#if defined(FEAT_EVAL) || defined(PROTO)
/*
@@ -893,26 +913,6 @@ f_exepath(typval_T *argvars, typval_T *rettv)
rettv->vval.v_string = p;
}
/*
* Return TRUE if "fname" is a readable file.
*/
int
file_is_readable(char_u *fname)
{
int fd;
#ifndef O_NONBLOCK
# define O_NONBLOCK 0
#endif
if (*fname && !mch_isdir(fname)
&& (fd = mch_open((char *)fname, O_RDONLY | O_NONBLOCK, 0)) >= 0)
{
close(fd);
return TRUE;
}
return FALSE;
}
/*
* "filereadable()" function
*/