about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDavid Pugnasse <david.pugnasse@gmail.com>2011-10-25 02:15:53 +0200
committerDavid Pugnasse <david.pugnasse@gmail.com>2011-10-25 02:15:53 +0200
commit9ab9f65217df8dd75e171702bee2943ca295e956 (patch)
treee8ad067e88684068c40443b27fc09ca9f30f5843
parent8a2d5352480629aeb7a983ea4ddadf7005223907 (diff)
downloadranger-9ab9f65217df8dd75e171702bee2943ca295e956.tar.gz
core.main: fix --selectfile with relative paths
-rw-r--r--ranger/core/actions.py8
-rw-r--r--ranger/core/main.py1
2 files changed, 3 insertions, 6 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 3300a534..5364f391 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -344,12 +344,8 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 
 	def select_file(self, path):
 		path = path.strip()
-		dirname = os.path.dirname(path)
-		if dirname:
-			if self.enter_dir(dirname):
-				self.env.cwd.move_to_obj(path)
-		else:
-			self.env.cwd.move_to_obj(join(self.env.cwd.path, path))
+		if self.enter_dir(os.path.dirname(path)):
+			self.env.cwd.move_to_obj(path)
 
 	def history_go(self, relative):
 		"""Move back and forth in the history"""
diff --git a/ranger/core/main.py b/ranger/core/main.py
index 49513125..14e4b1f6 100644
--- a/ranger/core/main.py
+++ b/ranger/core/main.py
@@ -50,6 +50,7 @@ def main():
 	SettingsAware._setup(clean=arg.clean)
 
 	if arg.selectfile:
+		arg.selectfile = os.path.abspath(arg.selectfile)
 		arg.targets.insert(0, os.path.dirname(arg.selectfile))
 
 	targets = arg.targets or ['.']