Open ManevilleF opened 3 years ago
I've had some issues with the compiled .mgc
database files in robo9k/rust-magic#32 as well.
I believe it won't work to dynamically build against one version of libmagic
, then use another version at runtime and expect the compiled databases to be compatible.
A workaround could be shipping a database in text format and to compile it once on startup. The required magic_compile
function is available in the magic
crate as Cookie.compile
, but I haven't tested this exact use case yet.
Another option would be linking libmagic
statically, but that use case is not fully supported by the magic-sys
crate (yet).
That being said, are you sure you need a custom "default" database? You could just load the default database that comes with the user's libmagic
/ file
installation, see robo9k/rust-magic#22
Using this crate I get this
MagicError
using the default
MimeDetective::new()