summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-04-14 15:41:17 +0200
committerhut <hut@lavabit.com>2010-04-14 15:41:17 +0200
commit2f109a60fb6a7978b8259408ce8477824e4471e9 (patch)
treeb7234efc6f19b8bf0485be2f0ae56087fa3a1be4 /ranger
parent83832f33c4b69942a700702473917ea4baba83e5 (diff)
downloadranger-2f109a60fb6a7978b8259408ce8477824e4471e9.tar.gz
fsobject.fsobject: get the stat() of link destinations
Diffstat (limited to 'ranger')
-rw-r--r--ranger/fsobject/fsobject.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/ranger/fsobject/fsobject.py b/ranger/fsobject/fsobject.py
index e910a018..ada00bb0 100644
--- a/ranger/fsobject/fsobject.py
+++ b/ranger/fsobject/fsobject.py
@@ -167,8 +167,13 @@ class FileSystemObject(MimeTypeAware, FileManagerAware):
 			self.is_link = False
 			self.accessible = False
 		else:
+			self.is_link = stat.S_ISLNK(self.stat.st_mode)
+			if self.is_link:
+				try: # try to resolve the link
+					self.stat = os.stat(self.path)
+				except:  # it failed, so it must be a broken link
+					pass
 			mode = self.stat.st_mode
-			self.is_link = stat.S_ISLNK(mode)
 			self.is_device = bool(stat.S_ISCHR(mode) or stat.S_ISBLK(mode))
 			self.accessible = True