mirror of
https://github.com/simon987/sist2.git
synced 2025-04-04 07:52:59 +00:00
Fix magic database problem
This commit is contained in:
parent
0dc18a56c0
commit
5a82581992
@ -1,5 +1,16 @@
|
|||||||
|
|
||||||
with open("/usr/lib/file/magic.mgc", "rb") as f:
|
MAGIC_PATHS = [
|
||||||
data = f.read()
|
"/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)))
|
print("char magic_database_buffer[%d] = {%s};" % (len(data), ",".join(str(int(b)) for b in data)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user