lib/epubber/services/persistance.rb in epubber-0.1.5 vs lib/epubber/services/persistance.rb in epubber-0.2.0
- old
+ new
@@ -18,10 +18,14 @@
end
protected
def write(file, content)
- File.write path(file), content
+ if content.is_a?(File)
+ FileUtils.cp content.path, File.dirname(path(file))
+ else
+ File.write path(file), content
+ end
end
def create_path_for(file)
dir = File.dirname path(file)
FileUtils.mkdir_p dir unless File.directory?(dir)