The dired-copy-file and dired-rename-file commands do not use
adjustname() for the new path. Hence 'M-x dired-copy-file':

Dired: ~/filename

will not work. This diff fixes that behaviour. ok?

mark

Index: dired.c
===================================================================
RCS file: /cvs/src/usr.bin/mg/dired.c,v
retrieving revision 1.58
diff -u -p -r1.58 dired.c
--- dired.c     30 May 2013 04:27:18 -0000      1.58
+++ dired.c     30 May 2013 04:42:38 -0000
@@ -398,10 +398,11 @@ d_expunge(int f, int n)
 int
 d_copy(int f, int n)
 {
-       char    frname[NFILEN], toname[NFILEN], sname[NFILEN], *bufp;
-       int     ret;
-       size_t  off;
-       struct buffer *bp;
+       char             frname[NFILEN], toname[NFILEN], sname[NFILEN];
+       char            *topath, *bufp;
+       int              ret;
+       size_t           off;
+       struct buffer   *bp;
 
        if (d_makename(curwp->w_dotp, frname, sizeof(frname)) != FALSE) {
                ewprintf("Not a file");
@@ -419,7 +420,9 @@ d_copy(int f, int n)
                return (ABORT);
        else if (bufp[0] == '\0')
                return (FALSE);
-       ret = (copy(frname, toname) >= 0) ? TRUE : FALSE;
+
+       topath = adjustname(toname, TRUE);
+       ret = (copy(frname, topath) >= 0) ? TRUE : FALSE;
        if (ret != TRUE)
                return (ret);
        if ((bp = refreshbuffer(curbp)) == NULL)
@@ -431,7 +434,8 @@ d_copy(int f, int n)
 int
 d_rename(int f, int n)
 {
-       char             frname[NFILEN], toname[NFILEN], *bufp;
+       char             frname[NFILEN], toname[NFILEN];
+       char            *topath, *bufp;
        int              ret;
        size_t           off;
        struct buffer   *bp;
@@ -453,7 +457,9 @@ d_rename(int f, int n)
                return (ABORT);
        else if (bufp[0] == '\0')
                return (FALSE);
-       ret = (rename(frname, toname) >= 0) ? TRUE : FALSE;
+
+       topath = adjustname(toname, TRUE);
+       ret = (rename(frname, topath) >= 0) ? TRUE : FALSE;
        if (ret != TRUE)
                return (ret);
        if ((bp = refreshbuffer(curbp)) == NULL)

Reply via email to