diff options
author | hut <hut@lavabit.com> | 2010-04-14 15:41:17 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-04-14 15:41:17 +0200 |
commit | 2f109a60fb6a7978b8259408ce8477824e4471e9 (patch) | |
tree | b7234efc6f19b8bf0485be2f0ae56087fa3a1be4 | |
parent | 83832f33c4b69942a700702473917ea4baba83e5 (diff) | |
download | ranger-2f109a60fb6a7978b8259408ce8477824e4471e9.tar.gz |
fsobject.fsobject: get the stat() of link destinations
-rw-r--r-- | ranger/fsobject/fsobject.py | 7 |
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 |