From 7d21f3d5f7e552c2449ea982b96ed1f9949ed732 Mon Sep 17 00:00:00 2001 From: hut Date: Sat, 18 Jul 2009 17:11:07 +0200 Subject: bugfix concerning multithreading Directory#files sometimes contained illegal values: an array of strings rather than an array of entries. --- code/directory.rb | 17 +++++++++-------- 1 file 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, -- cgit 1.4.1-2-gfad0