app/uploaders/file_uploader.rb in lolita-file-upload-0.3.0 vs app/uploaders/file_uploader.rb in lolita-file-upload-0.3.0.1
- old
+ new
@@ -1,5 +1,6 @@
+require 'fileutils'
class FileUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :file
after :remove, :delete_empty_upstream_dirs
@@ -25,13 +26,13 @@
end
end
def delete_empty_upstream_dirs
path = ::File.expand_path(store_dir, root)
- Dir.delete(path) # fails if path not empty dir
+ #FileUtils.rm_rf path # always remove
# path = ::File.expand_path(base_store_dir, root)
- # Dir.delete(path) # fails if path not empty dir
+ Dir.delete(path) # fails if path not empty dir
rescue SystemCallError
true # nothing, the dir is not empty
end
def image?(file)
\ No newline at end of file