diff options
author | hut <hut@lavabit.com> | 2009-07-18 17:11:07 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2009-07-18 17:11:07 +0200 |
commit | 7d21f3d5f7e552c2449ea982b96ed1f9949ed732 (patch) | |
tree | 132e0e48081113f5793ebca72c304b40f698ac51 /code | |
parent | d2ca37dd6e3a2f37ae49a97edbc7c0936cc423ba (diff) | |
download | ranger-7d21f3d5f7e552c2449ea982b96ed1f9949ed732.tar.gz |
bugfix concerning multithreading
Directory#files sometimes contained illegal values: an array of strings rather than an array of entries.
Diffstat (limited to 'code')
-rw-r--r-- | code/directory.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/code/directory.rb b/code/directory.rb index 646a15df..191d3b93 100644 --- a/code/directory.rb +++ b/code/directory.rb @@ -26,23 +26,24 @@ class Directory def read_dir @mtime = File.mtime(@path) log @path - @files = Dir.new(@path).to_a rescue [] + files = Dir.new(@path).to_a rescue [] if Option.show_hidden - @files -= ['.', '..', 'lost+found'] + files -= ['.', '..', 'lost+found'] else - @files.reject!{|x| x[0] == ?. or x == 'lost+found'} + files.reject!{|x| x[0] == ?. or x == 'lost+found'} end if @@filter - @files.reject!{|x| x !~ @@filter} + files.reject!{|x| x !~ @@filter} end - if @files.empty? - @files = ['.'] + if files.empty? + files = ['.'] end - @files_raw = @files.map{|bn| File.join(@path, bn)} - @files.map!{|basename| Entry.new(@path, basename)} + @files_raw = files.map{|bn| File.join(@path, bn)} + files.map!{|basename| Entry.new(@path, basename)} + @files = files end attr_reader(:path, :files, :pos, :width, :files_raw, |