Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Falling back from mv to cp/rm on error.
Browse files Browse the repository at this point in the history
Closes #388
  • Loading branch information
ryansch authored and sikachu committed Jun 29, 2011
1 parent 290d914 commit 1ff1cc7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/paperclip/storage/filesystem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ def flush_writes #:nodoc:
file.close
FileUtils.mkdir_p(File.dirname(path(style_name)))
log("saving #{path(style_name)}")
FileUtils.mv(file.path, path(style_name))
begin
FileUtils.mv(file.path, path(style_name))
rescue SystemCallError
FileUtils.cp(file.path, path(style_name))
FileUtils.rm(file.path)
end
FileUtils.chmod(0644, path(style_name))
end
@queued_for_write = {}
Expand Down

0 comments on commit 1ff1cc7

Please sign in to comment.