updated: [66c9fde] Now a trailing slash will only be added in copy & move dialogs if the path itselfs

Patrick Winnertz winnie at debian.org
Wed Jan 28 23:13:04 UTC 2009


The following commit has been merged in the mc-4.6 branch:
commit 66c9fde141b2e3534d8e52087cc7ca688d388687
Author: Patrick Winnertz <winnie at debian.org>
Date:   Wed Jan 28 23:53:10 2009 +0100

    Now a trailing slash will only be added in copy & move dialogs if the path itselfs
    doesn't already have a trailing slash.
    
    Signed-off-by: Patrick Winnertz <winnie at debian.org>

diff --git a/src/file.c b/src/file.c
index 272f9a7..b8d54e7 100644
--- a/src/file.c
+++ b/src/file.c
@@ -1795,11 +1795,15 @@ panel_operate (void *source_panel, FileOperation operation,
 	 * dir is deleted)
 	 */
 	if (force_single)
-	    // just copy
+	    /* just copy */
 	    dest_dir_ = mhl_str_dup (dest_dir);
 	else
-	    // add trailing separator
-	    dest_dir_ = mhl_str_concat (dest_dir, PATH_SEP_STR);
+	    /* add trailing separator */
+	    if (*dest_dir && strcmp(&dest_dir[strlen(dest_dir)-1], PATH_SEP_STR)) {
+		dest_dir_ = mhl_str_concat (dest_dir, PATH_SEP_STR);
+	} else {
+		dest_dir_ = mhl_str_dup (dest_dir);
+	}
 	if (!dest_dir_) {
 	    file_op_context_destroy (ctx);
 	    return 0;

-- 
Midnight Commander Development



More information about the mc-devel mailing list