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

Local storage: Always try to create directories, handle already existing.

This reduces the chances of races where two client try to upload the same
file.
This commit is contained in:
Mark Yen 2014-09-23 14:11:03 -07:00
parent 1c96d0cabd
commit d3804d5142

View file

@ -95,8 +95,10 @@ module Fog
next
end
# create directory if it doesn't already exist
unless ::File.directory?(dir_path)
begin
Dir.mkdir(dir_path)
rescue Errno::EEXIST
raise unless ::File.directory?(dir_path)
end
end
file = ::File.new(path, 'wb')