diff options
-rw-r--r-- | ranger/fsobject/fsobject.py | 7 | ||||
-rw-r--r-- | ranger/gui/widgets/statusbar.py | 3 |
2 files changed, 5 insertions, 5 deletions
diff --git a/ranger/fsobject/fsobject.py b/ranger/fsobject/fsobject.py index f2f440c1..516f02e6 100644 --- a/ranger/fsobject/fsobject.py +++ b/ranger/fsobject/fsobject.py @@ -76,7 +76,7 @@ class FileSystemObject(MimeTypeAware, FileManagerAware): self.basename = basename(path) self.basename_lower = self.basename.lower() self.dirname = dirname(path) - self.realpath = realpath(path) + self.realpath = self.path try: lastdot = self.basename.rindex('.') + 1 @@ -172,6 +172,8 @@ class FileSystemObject(MimeTypeAware, FileManagerAware): self.is_link = stat.S_ISLNK(self.stat.st_mode) if self.is_link: try: # try to resolve the link + self.readlink = os.readlink(self.path) + self.realpath = realpath(self.path) self.stat = os.stat(self.path) except: # it failed, so it must be a broken link pass @@ -219,9 +221,6 @@ class FileSystemObject(MimeTypeAware, FileManagerAware): self.exists = False self.runnable = False - if self.is_link: - self.readlink = os.readlink(self.path) - def get_permission_string(self): if self.permissions is not None: return self.permissions diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index 52425943..bff3d8ad 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -164,7 +164,8 @@ class StatusBar(Widget): if target.is_link: how = target.exists and 'good' or 'bad' - left.add(' -> ' + target.readlink, 'link', how) + dest = target.readlink if target.readlink is not None else '?' + left.add(' -> ' + dest, 'link', how) else: if self.settings.display_size_in_status_bar and target.infostring: left.add(target.infostring) |