summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/core/actions.py2
-rw-r--r--ranger/defaults/commands.py15
2 files changed, 13 insertions, 4 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 8cecf077..7bb80343 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -830,6 +830,6 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 			src = src.path
 
 		try:
-			os.rename(src, dest)
+			os.renames(src, dest)
 		except OSError as err:
 			self.notify(err)
diff --git a/ranger/defaults/commands.py b/ranger/defaults/commands.py
index ad3fa0e5..319c5cef 100644
--- a/ranger/defaults/commands.py
+++ b/ranger/defaults/commands.py
@@ -632,11 +632,20 @@ class rename(Command):
 
 	def execute(self):
 		from ranger.fsobject import File
+		from os import access
+		from os.path import join
+
 		line = parse(self.line)
-		if not line.rest(1):
+		new_name = line.rest(1)
+
+		if not new_name:
 			return self.fm.notify('Syntax: rename <newname>', bad=True)
-		self.fm.rename(self.fm.env.cf, line.rest(1))
-		f = File(line.rest(1))
+
+		if access(new_name, os.F_OK):
+			return self.fm.notify("Can't rename: file already exists!", bad=True)
+
+		self.fm.rename(self.fm.env.cf, new_name)
+		f = File(new_name)
 		self.fm.env.cwd.pointed_obj = f
 		self.fm.env.cf = f
 
'Blame the previous revision' href='/akspecs/ranger/blame/ranger.py?h=v1.1.0&id=db9bb0c9026b38acdf1174f2be5851acd47e066b'>^
4d6c426f ^
5c210a96 ^
4072a34d ^
4d6c426f ^
a66c4a26 ^
3de15ddd ^
a66c4a26 ^


f027adc0 ^
5c210a96 ^

3de15ddd ^

5c210a96 ^
fb275079 ^

5c210a96 ^
3d566884 ^
a1d7ed6e ^
3d566884 ^
621a1a39 ^
9bc5d95c ^
c44b726e ^
465bff73 ^




f027adc0 ^
f8e96a97 ^

0b5c4cbe ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61