diff options
author | hut <hut@lavabit.com> | 2010-04-18 12:42:02 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-04-18 12:42:02 +0200 |
commit | 10b422572c019122aa8dffe2eb8417b499eb8f19 (patch) | |
tree | ef13092dfa8b0bc96cc0cd7933218f0e2d645bd1 | |
parent | 7b1db25e9c7a8454f2fa6f926892d8aa05e1d17a (diff) | |
parent | f36fa322acdd417590fda8c9acdf3aa836cd017a (diff) | |
download | ranger-10b422572c019122aa8dffe2eb8417b499eb8f19.tar.gz |
Merge branch 'master' into devel
-rw-r--r-- | ranger/fsobject/directory.py | 7 | ||||
-rw-r--r-- | ranger/fsobject/fsobject.py | 22 |
2 files changed, 14 insertions, 15 deletions
diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py index 3cec1646..63d2f24d 100644 --- a/ranger/fsobject/directory.py +++ b/ranger/fsobject/directory.py @@ -202,11 +202,6 @@ class Directory(FileSystemObject, Accumulator, SettingsAware): self.filenames = filenames self.files = files - if self == self.fm.env.cwd: - for dir in self.files: - if dir.is_directory and dir.infostring == 'unknown': - dir.determine_infostring() - self._clear_marked_items() for item in self.files: if item.path in marked_paths: @@ -225,9 +220,9 @@ class Directory(FileSystemObject, Accumulator, SettingsAware): self.filenames = None self.files = None - self.determine_infostring() self.cycle_list = None self.content_loaded = True + self.determine_infostring() self.last_update_time = time() finally: diff --git a/ranger/fsobject/fsobject.py b/ranger/fsobject/fsobject.py index 4ebec3bc..f3d40614 100644 --- a/ranger/fsobject/fsobject.py +++ b/ranger/fsobject/fsobject.py @@ -157,27 +157,31 @@ class FileSystemObject(MimeTypeAware, FileManagerAware): self.marked = bool(boolean) def determine_infostring(self): + self.size = 0 if self.is_device: self.infostring = 'dev' elif self.is_fifo: self.infostring = 'fifo' elif self.is_socket: self.infostring = 'sock' - elif self.is_link: - self.infostring = '->' elif self.is_directory: try: self.size = len(os.listdir(self.path)) - self.infostring = " %d" % self.size - self.accessible = True - self.runnable = True except OSError: - self.size = 0 self.infostring = BAD_INFO self.accessible = False + else: + self.infostring = " %d" % self.size + self.accessible = True + self.runnable = True elif self.is_file: - self.size = self.stat.st_size - self.infostring = ' ' + human_readable(self.size) + try: + self.size = self.stat.st_size + self.infostring = ' ' + human_readable(self.size) + except: + pass + if self.is_link: + self.infostring = '->' + self.infostring def load(self): """ @@ -186,7 +190,6 @@ class FileSystemObject(MimeTypeAware, FileManagerAware): """ self.loaded = True - try: self.stat = os.lstat(self.path) except OSError: @@ -213,6 +216,7 @@ class FileSystemObject(MimeTypeAware, FileManagerAware): self.accessible = True if os.path.isdir(self.path): self.type = T_DIRECTORY + self.runnable = bool(mode & stat.S_IXUSR) elif os.path.isfile(self.path): self.type = T_FILE else: |