updated: [abc295c] Merge branch 'mc-4.6'



The following commit has been merged in the master branch:
commit abc295cee2f4098c745429ed8464907628b49386
Merge: cad6ffd2bb47beb653e574d69d539fc6b9ffaaf9 66c9fde141b2e3534d8e52087cc7ca688d388687
Author: Sergei Trofimovich <slyfox inbox ru>
Date:   Thu Jan 29 01:12:09 2009 +0200

    Merge branch 'mc-4.6'
    
    * mc-4.6:
      Now a trailing slash will only be added in copy & move dialogs if the path itselfs
      copy/move dialog: add trailing '/' to default destination path (fix #181)

diff --combined src/file.c
index 100ab3e,b8d54e7..5606691
--- a/src/file.c
+++ b/src/file.c
@@@ -50,6 -50,8 +50,8 @@@
  #include <sys/stat.h>
  #include <unistd.h>
  
+ #include <mhl/string.h>
+ 
  #include "global.h"
  #include "tty.h"
  #include "eregex.h"
@@@ -212,7 -214,7 +214,7 @@@ do_transform_source (FileOpContext *ctx
  	case '*':
  	    if (next_reg < 0 || next_reg >= RE_NREGS
  		|| ctx->regs.start[next_reg] < 0) {
 -		message (1, MSG_ERROR, _(" Invalid target mask "));
 +		message (D_ERROR, MSG_ERROR, _(" Invalid target mask "));
  		transform_error = FILE_ABORT;
  		return NULL;
  	    }
@@@ -312,7 -314,7 +314,7 @@@ check_hardlinks (const char *src_name, 
  		    }
  		}
  	    }
 -	    message (1, MSG_ERROR, _(" Cannot make the hardlink "));
 +	    message (D_ERROR, MSG_ERROR, _(" Cannot make the hardlink "));
  	    return 0;
  	}
      lp = (struct link *) g_malloc (sizeof (struct link) + strlen (src_name)
@@@ -366,7 -368,7 +368,7 @@@ make_symlink (FileOpContext *ctx, cons
  
      if (ctx->stable_symlinks)
  	if (!vfs_file_is_local (src_path) || !vfs_file_is_local (dst_path)) {
 -	    message (1, MSG_ERROR,
 +	    message (D_ERROR, MSG_ERROR,
  			_(" Cannot make stable symlinks across "
  			  "non-local filesystems: \n\n"
  			  " Option Stable Symlinks will be disabled "));
@@@ -510,7 -512,7 +512,7 @@@ copy_file_file (FileOpContext *ctx, con
      if (dst_exists) {
  	/* Destination already exists */
  	if (sb.st_dev == sb2.st_dev && sb.st_ino == sb2.st_ino) {
 -	    message (1, MSG_ERROR,
 +	    message (D_ERROR, MSG_ERROR,
  		    _(" `%s' and `%s' are the same file "), src_path, dst_path);
  	    do_refresh ();
  	    return FILE_SKIP;
@@@ -586,7 -588,7 +588,7 @@@
  
      if (ctx->do_reget) {
  	if (mc_lseek (src_desc, ctx->do_reget, SEEK_SET) != ctx->do_reget) {
 -	    message (1, _("Warning"),
 +	    message (D_ERROR, _("Warning"),
  			_(" Reget failed, about to overwrite file "));
  	    ctx->do_reget = ctx->do_append = 0;
  	}
@@@ -868,7 -870,7 +870,7 @@@ copy_dir_dir (FileOpContext *ctx, cons
  
      if (is_in_linklist (parent_dirs, s, &cbuf)) {
  	/* we found a cyclic symbolic link */
 -	message (1, MSG_ERROR,
 +	message (D_ERROR, MSG_ERROR,
  		    _(" Cannot copy cyclic symbolic link \n `%s' "), s);
  	return FILE_SKIP;
      }
@@@ -1052,14 -1054,14 +1054,14 @@@ move_file_file (FileOpContext *ctx, con
  
  	    strcpy (st, path_trunc (s, msize));
  	    strcpy (dt, path_trunc (d, msize));
 -	    message (1, MSG_ERROR,
 +	    message (D_ERROR, MSG_ERROR,
  			_(" `%s' and `%s' are the same file "), st, dt);
  	    do_refresh ();
  	    return FILE_SKIP;
  	}
  
  	if (S_ISDIR (dst_stats.st_mode)) {
 -	    message (1, MSG_ERROR,
 +	    message (D_ERROR, MSG_ERROR,
  			_(" Cannot overwrite directory `%s' "), d);
  	    do_refresh ();
  	    return FILE_SKIP;
@@@ -1175,7 -1177,7 +1177,7 @@@ move_dir_dir (FileOpContext *ctx, cons
  
  	strcpy (st, path_trunc (s, msize));
  	strcpy (dt, path_trunc (d, msize));
 -	message (1, MSG_ERROR,
 +	message (D_ERROR, MSG_ERROR,
  		    _(" `%s' and `%s' are the same directory "), st, dt);
  	do_refresh ();
  	return FILE_SKIP;
@@@ -1753,7 -1755,7 +1755,7 @@@ panel_operate (void *source_panel, File
  	}
  
  	if (!strcmp (source, "..")) {
 -	    message (1, MSG_ERROR, _(" Cannot operate on \"..\"! "));
 +	    message (D_ERROR, MSG_ERROR, _(" Cannot operate on \"..\"! "));
  	    return 0;
  	}
      }
@@@ -1777,6 -1779,7 +1779,7 @@@
  	}
      } else if (operation != OP_DELETE) {
  	char *dest_dir;
+ 	char *dest_dir_;
  
  	/* Forced single operations default to the original name */
  	if (force_single)
@@@ -1786,9 -1789,31 +1789,31 @@@
  	else
  	    dest_dir = panel->cwd;
  
+ 	/*
+ 	 * Add trailing backslash only when do non-locally ops.
+ 	 * It saves user from occasional file renames (when destination
+ 	 * dir is deleted)
+ 	 */
+ 	if (force_single)
+ 	    /* just copy */
+ 	    dest_dir_ = mhl_str_dup (dest_dir);
+ 	else
+ 	    /* 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;
+ 	}
+ 
  	dest =
- 	    file_mask_dialog (ctx, operation, cmd_buf, dest_dir,
+ 	    file_mask_dialog (ctx, operation, cmd_buf, dest_dir_,
  			      single_entry, &do_bg);
+ 	mhl_mem_free(dest_dir_);
+ 
  	if (!dest) {
  	    file_op_context_destroy (ctx);
  	    return 0;
@@@ -1808,7 -1833,7 +1833,7 @@@
  			   g_strconcat (op_names[operation], ": ",
  					panel->cwd, NULL));
  	if (v == -1) {
 -	    message (1, MSG_ERROR,
 +	    message (D_ERROR, MSG_ERROR,
  		     _(" Sorry, I could not put the job in background "));
  	}
  

-- 
Midnight Commander Development


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]