1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[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.
This commit is contained in:
Benjamin Manns 2012-02-15 12:52:52 -05:00
parent 1886bde528
commit 1deb159c6a

View file

@ -50,7 +50,7 @@ module Fog
break break
end end
pwd = Dir.pwd pwd = Dir.pwd
if ::Dir.exists?(dir_path) if ::File.exists?(dir_path) && ::File.directory?(dir_path)
Dir.chdir(dir_path) Dir.chdir(dir_path)
if Dir.glob('*').empty? if Dir.glob('*').empty?
Dir.rmdir(dir_path) Dir.rmdir(dir_path)