Skip to content

Commit

Permalink
[local|storage] Fix Local::File deletion for Ruby 1.8.
Browse files Browse the repository at this point in the history
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#707.
  • Loading branch information
benmanns committed Feb 15, 2012
1 parent 1886bde commit 1deb159
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fog/local/models/storage/file.rb
Expand Up @@ -50,7 +50,7 @@ def destroy
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)
Expand Down

0 comments on commit 1deb159

Please sign in to comment.