From e3e8a75a2a6f9cfad433acee32cba30bc2449a8f Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Thu, 20 Apr 2000 21:01:16 +0000 Subject: [PATCH] (Ffile_writable_p) [WINDOWSNT]: Return nil if parent directory doesn't exist. --- src/fileio.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/fileio.c b/src/fileio.c index 545061ba0d1..59d09a93157 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2947,8 +2947,17 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0, #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, -- 2.39.5