win: autopatch: Support both dll/dl_ as targets

This commit is contained in:
Jai Luthra 2023-06-17 00:39:33 +05:30 committed by GitHub
parent b368b4ea09
commit 9e20a7068f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,8 +156,11 @@ def make_patch(archive, *,
tmpdir,
arch_tgt,
sevenzip=sevenzip) as tgt:
with open(tgt, 'rb') as fo:
f = fo.read()
if tgt.endswith(".dll"):
with open(tgt, 'rb') as fo:
f = fo.read()
else:
f = expand(tgt, sevenzip=sevenzip)
offset = f.find(search)
if offset == -1:
raise PatternNotFoundException("Pattern not found.")