Try to overwrite the file in VPATH if possible

This commit is contained in:
Nobuyoshi Nakada 2022-11-13 18:05:11 +09:00
parent 66529eef88
commit 70c9d5b504
No known key found for this signature in database
GPG Key ID: 7CD2805BFA3770C6

View File

@ -28,7 +28,8 @@ class Output
updated = color.fail("updated")
outpath = nil
if @ifchange and (@vpath.open(@path, "rb") {|f| outpath = f.path; f.read == data} rescue false)
if (@ifchange or overwrite) and
(@vpath.open(@path, "rb") {|f| outpath = f.path; f.read == data if @ifchange} rescue false)
puts "#{outpath} #{unchanged}"
written = false
else