[Xfce4-commits] <archive:master> Don't list empty directories.
Nick Schermer
noreply at xfce.org
Sat Apr 14 11:42:01 CEST 2012
Updating branch refs/heads/master
to 091acfa8ebe042399c5fc7046c22fe8b6ccdaf5a (commit)
from 2f39c0490791345ae44bd80c9650dd7bd6f1be2c (commit)
commit 091acfa8ebe042399c5fc7046c22fe8b6ccdaf5a
Author: Nick Schermer <nick at xfce.org>
Date: Sat Apr 14 11:40:26 2012 +0200
Don't list empty directories.
fancyindex/models/archive.rb | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/fancyindex/models/archive.rb b/fancyindex/models/archive.rb
index e791621..81ecb86 100644
--- a/fancyindex/models/archive.rb
+++ b/fancyindex/models/archive.rb
@@ -89,7 +89,14 @@ module Fancyindex
def list_items
@items = []
Dir.entries(self.path).each do |name|
- @items << Archive::Item.new(self, name) if not (name == '.' || name == '..')
+ # skip default directory entries
+ next if name == '.' or name == '..'
+
+ # skip empty directories
+ fullpath = File.join(self.path, name)
+ next if File.directory?(fullpath) and Dir.entries(fullpath) == ['.', '..']
+
+ @items << Archive::Item.new(self, name)
end
@items.sort!
end
More information about the Xfce4-commits
mailing list