lib/zold/copies.rb in zold-0.11.7 vs lib/zold/copies.rb in zold-0.11.8
- old
+ new
@@ -64,10 +64,10 @@
raise "Score can't be negative: #{score}" if score < 0
FileUtils.mkdir_p(@dir)
list = load
target = list.find do |s|
f = File.join(@dir, s[:name])
- File.exist?(f) && File.read(f) == content
+ File.exist?(f) && AtomicFile.new(f).read == content
end
if target.nil?
max = Dir.new(@dir)
.select { |f| f =~ /^[0-9]+$/ }
.map(&:to_i)