aboutsummaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorGerd Moellmann <[email protected]>2001-10-05 12:50:48 +0000
committerGerd Moellmann <[email protected]>2001-10-05 12:50:48 +0000
commita9d14e54a813172e7a841371981e426c72f8feb4 (patch)
treed681b671dec5ac67e0b5e87635f4be204f5148cd /src/fileio.c
parent7bdb67b2b38fec58469658b93bcf6f6ecaf69ea3 (diff)
(Fcopy_file): If NEWNAME is a directory copy FILE there.
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/fileio.c b/src/fileio.c
index b152f0a74e..4c7921752a 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2287,6 +2287,7 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick)
DEFUN ("copy-file", Fcopy_file, Scopy_file, 2, 4,
"fCopy file: \nFCopy %s to file: \np\nP",
"Copy FILE to NEWNAME. Both args must be strings.\n\
+If NEWNAME names a directory, copy FILE there.\n\
Signals a `file-already-exists' error if file NEWNAME already exists,\n\
unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil.\n\
A number as third arg means request confirmation if NEWNAME already exists.\n\
@@ -2311,8 +2312,12 @@ A prefix arg makes KEEP-TIME non-nil.")
CHECK_STRING (file, 0);
CHECK_STRING (newname, 1);
+ if (!NILP (Ffile_directory_p (newname)))
+ newname = Fexpand_file_name (file, newname);
+ else
+ newname = Fexpand_file_name (newname, Qnil);
+
file = Fexpand_file_name (file, Qnil);
- newname = Fexpand_file_name (newname, Qnil);
/* If the input file name has special constructs in it,
call the corresponding file handler. */