lib/boxafe/box.rb in boxafe-0.1.7 vs lib/boxafe/box.rb in boxafe-0.1.9
- old
+ new
@@ -32,10 +32,11 @@
sleep options[:umount_delay] if options[:umount_delay] and options[:umount_delay] > 0
result
end
def mounted?
- File.directory? mount_options[:mount]
+ # TODO: check if it's possible to differentiate between an empty mounted directory and an unmounted directory
+ File.directory?(mount_options[:mount]) && !Dir.entries(mount_options[:mount]).reject{ |e| e.match(/^\.{1,2}$/) }.empty?
end
def mount_options
default_mount_options.merge(@options).tap do |options|
options[:keychain] = @options[:name] if options[:keychain] == true