aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>2005-03-11 23:49:25 +0000
committerRichard M. Stallman <[email protected]>2005-03-11 23:49:25 +0000
commit1ffc5c90de45d72d5435935c4a4a31b08cb7652b (patch)
tree652db59b2359d9138bf18710cc403b4103bf861c /src
parent0e425a588c5da4a076c24b0cc0d11b2d4bfb3912 (diff)
(Frename_file, Fadd_name_to_file)
(Fmake_symbolic_link): If NEWNAME or LINKNAME is a directory, expand the basename of FILE relative to it.
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 2287025362..879c384755 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2691,7 +2691,11 @@ This is what happens in interactive use with M-x. */)
CHECK_STRING (file);
CHECK_STRING (newname);
file = Fexpand_file_name (file, Qnil);
- newname = Fexpand_file_name (newname, Qnil);
+
+ if (!NILP (Ffile_directory_p (newname)))
+ newname = Fexpand_file_name (Ffile_name_nondirectory (file), newname);
+ else
+ newname = Fexpand_file_name (newname, Qnil);
/* If the file name has special constructs in it,
call the corresponding file handler. */
@@ -2774,7 +2778,11 @@ This is what happens in interactive use with M-x. */)
CHECK_STRING (file);
CHECK_STRING (newname);
file = Fexpand_file_name (file, Qnil);
- newname = Fexpand_file_name (newname, Qnil);
+
+ if (!NILP (Ffile_directory_p (newname)))
+ newname = Fexpand_file_name (Ffile_name_nondirectory (file), newname);
+ else
+ newname = Fexpand_file_name (newname, Qnil);
/* If the file name has special constructs in it,
call the corresponding file handler. */
@@ -2841,7 +2849,11 @@ This happens for interactive use with M-x. */)
we want to permit links to relative file names. */
if (SREF (filename, 0) == '~')
filename = Fexpand_file_name (filename, Qnil);
- linkname = Fexpand_file_name (linkname, Qnil);
+
+ if (!NILP (Ffile_directory_p (linkname)))
+ linkname = Fexpand_file_name (Ffile_name_nondirectory (file), linkname);
+ else
+ linkname = Fexpand_file_name (linkname, Qnil);
/* If the file name has special constructs in it,
call the corresponding file handler. */