summaryrefslogtreecommitdiff
path: root/src/misc1.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc1.c')
-rw-r--r--src/misc1.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/misc1.c b/src/misc1.c
index bef297cf2..cd8acceaa 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -4443,6 +4443,29 @@ vim_ispathlistsep(c)
}
#endif
+/*
+ * Return TRUE if the directory of "fname" exists, FALSE otherwise.
+ * Also returns TRUE if there is no directory name.
+ * "fname" must be writable!.
+ */
+ int
+dir_of_file_exists(fname)
+ char_u *fname;
+{
+ char_u *p;
+ int c;
+ int retval;
+
+ p = gettail_sep(fname);
+ if (p == fname)
+ return TRUE;
+ c = *p;
+ *p = NUL;
+ retval = mch_isdir(fname);
+ *p = c;
+ return retval;
+}
+
#if (defined(CASE_INSENSITIVE_FILENAME) && defined(BACKSLASH_IN_FILENAME)) \
|| defined(PROTO)
/*