changeset 50340:810c2ac4b064

(Fexpand_file_name): In the no-handler case, after expanding, look again for a handler and invoke it. This is needed for filenames like "/foo/../user@host:/bar/../baz" -- the first expansion produces "/user@host:/bar/../baz" which needs to be expanded again for the finame result "/user@host:/baz".
author Kai Großjohann <kgrossjo@eu.uu.net>
date Sat, 29 Mar 2003 16:34:35 +0000
parents b8ecb0403fa1
children f49a20cb84ed
files src/ChangeLog src/fileio.c
diffstat 2 files changed, 22 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sat Mar 29 15:31:07 2003 +0000
+++ b/src/ChangeLog	Sat Mar 29 16:34:35 2003 +0000
@@ -1,3 +1,11 @@
+2003-03-29  Kai Gro,A_(Bjohann  <kai.grossjohann@gmx.net>
+
+	* fileio.c (Fexpand_file_name): In the no-handler case, after
+	expanding, look again for a handler and invoke it.  This is needed
+	for filenames like "/foo/../user@host:/bar/../baz" -- the first
+	expansion produces "/user@host:/bar/../baz" which needs to be
+	expanded again for the finame result "/user@host:/baz".
+
 2003-03-28  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
 	* gtkutil.c (xg_tool_bar_item_expose_callback): Reduce size
--- a/src/fileio.c	Sat Mar 29 15:31:07 2003 +0000
+++ b/src/fileio.c	Sat Mar 29 16:34:35 2003 +0000
@@ -1026,7 +1026,7 @@
   int is_escaped = 0;
 #endif /* DOS_NT */
   int length;
-  Lisp_Object handler;
+  Lisp_Object handler, result;
 
   CHECK_STRING (name);
 
@@ -1678,8 +1678,19 @@
   CORRECT_DIR_SEPS (target);
 #endif /* DOS_NT */
 
-  return make_specified_string (target, -1, o - target,
-				STRING_MULTIBYTE (name));
+  result = make_specified_string (target, -1, o - target,
+                                  STRING_MULTIBYTE (name));
+
+  /* Again look to see if the file name has special constructs in it
+     and perhaps call the corresponding file handler.  This is needed
+     for filenames such as "/foo/../user@host:/bar/../baz".  Expanding
+     the ".." component gives us "/user@host:/bar/../baz" which needs
+     to be expanded again. */
+  handler = Ffind_file_name_handler (result, Qexpand_file_name);
+  if (!NILP (handler))
+    return call3 (handler, Qexpand_file_name, result, default_directory);
+
+  return result;
 }
 
 #if 0