aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/fileio.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c
index b92492c93a6..2dcfb73b0d5 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2296,6 +2296,21 @@ The arg must be a string. */)
2296 if (!NILP (handler)) 2296 if (!NILP (handler))
2297 return call2 (handler, Qfile_name_case_insensitive_p, filename); 2297 return call2 (handler, Qfile_name_case_insensitive_p, filename);
2298 2298
2299 /* If the file doesn't exist, move up the filesystem tree until we
2300 reach an existing directory or the root. */
2301 if (NILP (Ffile_exists_p (filename)))
2302 {
2303 filename = Ffile_name_directory (filename);
2304 while (NILP (Ffile_exists_p (filename)))
2305 {
2306 Lisp_Object newname = expand_and_dir_to_file (filename);
2307 /* Avoid infinite loop if the root is reported as non-existing
2308 (impossible?). */
2309 if (!NILP (Fstring_equal (newname, filename)))
2310 break;
2311 filename = newname;
2312 }
2313 }
2299 filename = ENCODE_FILE (filename); 2314 filename = ENCODE_FILE (filename);
2300 return file_name_case_insensitive_p (SSDATA (filename)) ? Qt : Qnil; 2315 return file_name_case_insensitive_p (SSDATA (filename)) ? Qt : Qnil;
2301} 2316}