mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #461 from socialreferral/master
Small fixes to Local storage
This commit is contained in:
commit
4847886472
1 changed files with 8 additions and 6 deletions
|
@ -38,7 +38,7 @@ module Fog
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
requires :directory, :key
|
requires :directory, :key
|
||||||
::File.delete(path)
|
::File.delete(path) if ::File.exists?(path)
|
||||||
dirs = path.split(::File::SEPARATOR)[0...-1]
|
dirs = path.split(::File::SEPARATOR)[0...-1]
|
||||||
dirs.length.times do |index|
|
dirs.length.times do |index|
|
||||||
dir_path = dirs[0..-index].join(::File::SEPARATOR)
|
dir_path = dirs[0..-index].join(::File::SEPARATOR)
|
||||||
|
@ -50,11 +50,13 @@ module Fog
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
pwd = Dir.pwd
|
pwd = Dir.pwd
|
||||||
Dir.chdir(dir_path)
|
if ::Dir.exists?(dir_path)
|
||||||
if Dir.glob('*').empty?
|
Dir.chdir(dir_path)
|
||||||
Dir.rmdir(dir_path)
|
if Dir.glob('*').empty?
|
||||||
|
Dir.rmdir(dir_path)
|
||||||
|
end
|
||||||
|
Dir.chdir(pwd)
|
||||||
end
|
end
|
||||||
Dir.chdir(pwd)
|
|
||||||
end
|
end
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
@ -80,7 +82,7 @@ module Fog
|
||||||
Dir.mkdir(dir_path)
|
Dir.mkdir(dir_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
file = ::File.new(path, 'w')
|
file = ::File.new(path, 'wb')
|
||||||
if body.is_a?(String)
|
if body.is_a?(String)
|
||||||
file.write(body)
|
file.write(body)
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue