From 5a82581992a34955f225bb2c0e61839ca2b5ce6b Mon Sep 17 00:00:00 2001 From: Shy Date: Thu, 23 Jan 2025 21:40:27 -0500 Subject: [PATCH] Fix magic database problem --- scripts/magic_static.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/magic_static.py b/scripts/magic_static.py index 90d6f3d..897cfad 100644 --- a/scripts/magic_static.py +++ b/scripts/magic_static.py @@ -1,5 +1,16 @@ -with open("/usr/lib/file/magic.mgc", "rb") as f: - data = f.read() +MAGIC_PATHS = [ + "/vcpkg/installed/x64-linux/share/libmagic/misc/magic.mgc", + "/work/vcpkg/installed/x64-linux/share/libmagic/misc/magic.mgc", + "/usr/lib/file/magic.mgc" +] + +for path in MAGIC_PATHS: + try: + with open(path, "rb") as f: + data = f.read() + break + except: + continue print("char magic_database_buffer[%d] = {%s};" % (len(data), ",".join(str(int(b)) for b in data)))