ambrevar: Patch magicffi to support wildcards.

master
Pierre Neidhardt 2021-05-09 11:13:18 +02:00
parent f68056ae31
commit 43f674f710
2 changed files with 20 additions and 1 deletions

View File

@ -2,4 +2,5 @@
(defsystem "ambrevar"
:class :package-inferred-system
:depends-on ("ambrevar/all"))
:depends-on ("ambrevar/all")
:components ((:file "patch-magicffi")))

View File

@ -0,0 +1,18 @@
(in-package :magicffi)
(defun path-string (path)
(uiop:unix-namestring
(uiop:truename* (if (pathnamep path)
path
(uiop:parse-native-namestring path)))))
;; Original function uses %truename which fails on wildcards.
(defun magic-file (magic pathspec)
"Returns a textual description of the contents of the PATHSPEC
argument. PATHSPEC is a pathname designator. An error of type
MAGIC-ERROR is signaled on failure."
(or (foreign-funcall "magic_file"
cmagic magic
:string (path-string pathspec)
:string)
(magic-error magic)))