summary refs log tree commit diff stats
path: root/ranger/core/actions.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-10-30 02:23:12 +0200
committerhut <hut@lavabit.com>2011-10-30 02:23:12 +0200
commitec6093297e8851802ff2184cd2949bb9cfbad1d7 (patch)
tree437ceadbcc2bc09209a5d4c65a591a00b818bcaf /ranger/core/actions.py
parent2081cbe1f64017100ccfccd34a75d7731ff77dae (diff)
downloadranger-ec6093297e8851802ff2184cd2949bb9cfbad1d7.tar.gz
core.actions: paste_symlink() doesn't fail if file exists
Diffstat (limited to 'ranger/core/actions.py')
-rw-r--r--ranger/core/actions.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 5364f391..00fd2179 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -28,6 +28,7 @@ from ranger.ext.direction import Direction
 from ranger.ext.relative_symlink import relative_symlink
 from ranger.ext.keybinding_parser import key_to_string, construct_keybinding
 from ranger.ext.shell_escape import shell_quote
+from ranger.ext.next_available_filename import next_available_filename
 from ranger.core.shared import FileManagerAware, EnvironmentAware, \
 		SettingsAware
 from ranger.fsobject import File
@@ -918,18 +919,21 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 	def paste_symlink(self, relative=False):
 		copied_files = self.env.copy
 		for f in copied_files:
+			self.notify(next_available_filename(f.basename))
 			try:
+				new_name = next_available_filename(f.basename)
 				if relative:
-					relative_symlink(f.path, join(getcwd(), f.basename))
+					relative_symlink(f.path, join(getcwd(), new_name))
 				else:
-					symlink(f.path, join(getcwd(), f.basename))
+					symlink(f.path, join(getcwd(), new_name))
 			except Exception as x:
 				self.notify(x)
 
 	def paste_hardlink(self):
 		for f in self.env.copy:
 			try:
-				link(f.path, join(getcwd(), f.basename))
+				new_name = next_available_filename(f.basename)
+				link(f.path, join(getcwd(), new_name))
 			except Exception as x:
 				self.notify(x)