changeset 28673:55c84ae4d634

(Ffile_writable_p) [WINDOWSNT]: Return nil if parent directory doesn't exist.
author Gerd Moellmann <gerd@gnu.org>
date Thu, 20 Apr 2000 21:01:16 +0000
parents 4cb794d0027e
children 33b9dd030d3b
files src/fileio.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.c	Thu Apr 20 21:00:43 2000 +0000
+++ b/src/fileio.c	Thu Apr 20 21:01:16 2000 +0000
@@ -2947,8 +2947,17 @@
 #endif /* MSDOS */
 
   dir = ENCODE_FILE (dir);
+#ifdef WINDOWSNT
+  /* The read-only attribute of the parent directory doesn't affect
+     whether a file or directory can be created within it.  Some day we
+     should check ACLs though, which do affect this.  */
+  if (stat (XSTRING (dir)->data, &statbuf) < 0)
+    return Qnil;
+  return (statbuf.st_mode & S_IFMT) == S_IFDIR ? Qt : Qnil;
+#else
   return (check_writable (!NILP (dir) ? (char *) XSTRING (dir)->data : "")
 	  ? Qt : Qnil);
+#endif
 }
 
 DEFUN ("access-file", Faccess_file, Saccess_file, 2, 2, 0,