fix: ignore binaries for placeholder replace

This commit is contained in:
relikd
2025-09-09 15:15:35 +02:00
parent e3f0041224
commit 556a50e188

View File

@@ -1939,6 +1939,8 @@ class Fixer:
if File.isMachO(fname):
Dylib(fname).fix()
elif File.isBinary(fname):
pass # skip other binary (.a, .class, .png, ...)
else:
# replace all @@homebrew@@ placeholders
Fixer.inreplace(fname)
@@ -2677,6 +2679,11 @@ class File:
with open(fname, 'rb') as fp:
return fp.read(4) == b'\xcf\xfa\xed\xfe'
@staticmethod
def isBinary(fname: str) -> bool:
with open(fname, 'rb') as fp:
return b'\0' in fp.read(4096)
@staticmethod
def isOutdated(fname: str, maxage: int) -> bool:
''' Check if `fname` is older than `maxage` '''