From 2f109a60fb6a7978b8259408ce8477824e4471e9 Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 14 Apr 2010 15:41:17 +0200 Subject: fsobject.fsobject: get the stat() of link destinations --- ranger/fsobject/fsobject.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- cgit 1.4.1-2-gfad0