From 1deb159c6a1a89b224401247b89efa71efaf2fce Mon Sep 17 00:00:00 2001 From: Benjamin Manns Date: Wed, 15 Feb 2012 12:52:52 -0500 Subject: [PATCH] [local|storage] Fix Local::File deletion for Ruby 1.8. Ruby 1.8 doesn't have a Dir.exists? method, which causes an exception and prevents empty parent directories from being deleted. These changes use File.exists? and File.directory? in place of Dir.exists?. Fixes fog/fog#707. --- lib/fog/local/models/storage/file.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fog/local/models/storage/file.rb b/lib/fog/local/models/storage/file.rb index 992f7c78d..a57026762 100644 --- a/lib/fog/local/models/storage/file.rb +++ b/lib/fog/local/models/storage/file.rb @@ -50,7 +50,7 @@ module Fog break end pwd = Dir.pwd - if ::Dir.exists?(dir_path) + if ::File.exists?(dir_path) && ::File.directory?(dir_path) Dir.chdir(dir_path) if Dir.glob('*').empty? Dir.rmdir(dir_path)