about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-05-15 00:25:25 +0200
committerhut <hut@lavabit.com>2010-05-15 00:25:25 +0200
commitdb426717730e66a569b4c29659329aeb8f0cf263 (patch)
treecf690f9329e0b20d4febc177daffd890cccc3d41
parent6c34428d48141e62bdd7f4dcc0aa6cdf14dc65a2 (diff)
downloadranger-db426717730e66a569b4c29659329aeb8f0cf263.tar.gz
fsobject: remove readlink-attribute, catch OSError in realpath()
-rw-r--r--ranger/fsobject/fsobject.py9
-rw-r--r--ranger/gui/widgets/statusbar.py7
2 files changed, 10 insertions, 6 deletions
diff --git a/ranger/fsobject/fsobject.py b/ranger/fsobject/fsobject.py
index 9d942c65..f0adab67 100644
--- a/ranger/fsobject/fsobject.py
+++ b/ranger/fsobject/fsobject.py
@@ -35,8 +35,7 @@ class FileSystemObject(MimeTypeAware, FileManagerAware):
 	last_used,
 	path,
 	permissions,
-	readlink,
-	stat) = (None,) * 12
+	stat) = (None,) * 11
 
 	(content_loaded,
 	force_load,
@@ -209,8 +208,10 @@ class FileSystemObject(MimeTypeAware, FileManagerAware):
 				self.exists = False
 				self.runnable = False
 			if is_link:
-				self.realpath = realpath(path)
-				self.readlink = readlink(path)
+				try:
+					self.realpath = realpath(path)
+				except OSError:
+					pass  # it is impossible to get the link destination
 		else:
 			self.accessible = False
 
diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py
index 752bfd6b..3019930b 100644
--- a/ranger/gui/widgets/statusbar.py
+++ b/ranger/gui/widgets/statusbar.py
@@ -23,7 +23,7 @@ such as the space used by all the files in this directory.
 
 from pwd import getpwuid
 from grp import getgrgid
-from os import getuid
+from os import getuid, readlink
 from time import time, strftime, localtime
 
 from ranger.ext.human_readable import human_readable
@@ -164,7 +164,10 @@ class StatusBar(Widget):
 
 		if target.is_link:
 			how = target.exists and 'good' or 'bad'
-			dest = target.readlink if target.readlink is not None else '?'
+			try:
+				dest = readlink(target.path)
+			except:
+				dest = '?'
 			left.add(' -> ' + dest, 'link', how)
 		else:
 			if self.settings.display_size_in_status_bar and target.infostring: