lib/tori/backend/filesystem.rb in tori-0.0.7 vs lib/tori/backend/filesystem.rb in tori-0.0.8
- old
+ new
@@ -9,12 +9,16 @@
def write(filename, resource)
case resource
when String
::File.open(path(filename), 'w'){ |f| f.write resource }
- # see also https://bugs.ruby-lang.org/issues/11199
when Pathname
- ::IO.copy_stream resource.to_s, path(filename)
+ # see also https://bugs.ruby-lang.org/issues/11199
+ ::File.open(resource) { |src|
+ ::File.open(path(filename), 'w'){ |dst|
+ ::IO.copy_stream src, dst
+ }
+ }
else
::IO.copy_stream resource, path(filename)
end
end