Skip to content

Commit 2d7dec8

Browse files
committed
Verify XML manifest is realy patched
1 parent 2845e28 commit 2d7dec8

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎recipes/sandbox/60-side-by-side-assembly-ruby-3.123.rake‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,18 @@ if package.rubyver2 < "3.4"
5858
# Removing unnecessary spaces and comments from the embedded XML manifest gives us enough space to add the above XML elements.
5959
# Then the default MINGW manifest gets replaced by our custom XML content.
6060
# The rest of the available bytes is simply padded with spaces, so that we don't change positions within the EXE image.
61-
image.gsub!(/<\?xml.*?<assembly.*?<\/assembly>\n/m) do |m|
62-
newm = m.gsub(/^\s*<\/assembly>\s*$/, new + "</assembly>")
61+
patched = false
62+
image.gsub!(/<\?xml.*?<assembly.*?<\/assembly>\n?/m) do |m|
63+
newm = m.gsub(/\s*<\/assembly>\s*$/, new + "</assembly>")
6364
.gsub(/<!--.*?-->/m, "")
6465
.gsub(/^ +/, "")
6566
.gsub(/\n+/m, "\n")
6667

67-
raise "replacement manifest to big #{m.bytesize} < #{newm.bytesize}" if m.bytesize < newm.bytesize
68+
raise "replacement manifest too big #{m.bytesize} < #{newm.bytesize}" if m.bytesize < newm.bytesize
69+
patched = m != newm
6870
newm + " " * (m.bytesize - newm.bytesize)
6971
end
72+
raise "manifest XML not found in #{destpath}" unless patched
7073
File.binwrite(t.name, image)
7174
end
7275
end

0 commit comments

Comments
 (0)