Error with prompt-for-file inside of CAPI menu callback
I have the following code which is meant to display a file save dialog from a menu item on macOS:(defun load-key (&optional (file (capi::prompt-for-file "Select the Key File to load."
:pathname *keys-folder*
:filter "*.ptekey")))
(when file
(setf *key* (with-open-file (s file)
(read s)))))
(let ((text "Keys")
(load-key-text "Load Key...")
(generate-new-key-text "Generate New Key...")
(save-key-text "Save Key..."))
(defun keys-menu-callback (data interface)
(cond
((string= data load-key-text) (load-key))))
(defparameter *keys-menu* (make-instance 'capi:menu
:title text
:items (list load-key-text)
:callback 'keys-menu-callback)))
When I invoke the menu item, I get the following error in the console:
Error in generating the FLI template NIL FLI::DEFINE-PRECOMPILED-FOREIGN-OBJECT-TESTER-FUNCTIONS OBJC:OBJC-AT-QUESTION-MARK NIL
Error: An error of type FLI::MISSING-FORIEGN-TEMPLATE-CONDITION occured, arguments : (:TEMPLATE (FLI::DEFINE-PRECOMPILED-FOREIGN-OBJECT-TESTER-FUNCTIONS (#)))
1 (abort) Return to Cocoa Event Loop
Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.
CL-USER 1 : 1 >
I’m stumped. Prompt-for-file has worked for me before and the only thing I can think of is that I’m calling it inside of a menu callback which might be causing the problem. Any ideas?
—
Burton Samograd