# File lib/mspec/helpers/fs.rb, line 31 31: def rm_r(*paths) 32: paths.each do |path| 33: path = File.expand_path path 34: 35: prefix = SPEC_TEMP_DIR 36: unless path[0, prefix.size] == prefix 37: raise ArgumentError, "#{path} is not prefixed by #{prefix}" 38: end 39: 40: if File.directory? path 41: Dir.entries(path).each { |x| rm_r "#{path}/#{x}" unless x =~ /^\.\.?$/ } 42: Dir.rmdir path 43: elsif File.exists? path 44: File.delete path 45: end 46: end 47: end