diff src/filepath.c @ 29371:f8b07c537036 v9.0.0028

patch 9.0.0028: MS-Windows: tests fail if there is a "runtime" directory Commit: https://github.com/vim/vim/commit/022f9ef16c955d6b5fca0f53b79899c56a3966c5 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 2 17:36:31 2022 +0100 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".
author Bram Moolenaar <Bram@vim.org>
date Sat, 02 Jul 2022 18:45:02 +0200
parents da56650de132
children 827d9f2b7a71
line wrap: on
line diff
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -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)
 
 /*
@@ -894,26 +914,6 @@ f_exepath(typval_T *argvars, typval_T *r
 }
 
 /*
- * 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
  */
     void