Created
November 13, 2017 18:23
-
-
Save jmercouris/fcc9223a7c681fa07084ba0fb8b42887 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmethod load-cocoa-application ((a cocoa-application)) | |
(with-autorelease-pool | |
(let* ((bundle (#/mainBundle ns:ns-bundle)) | |
(info (#/infoDictionary bundle)) | |
(classname (#/objectForKey: info #@"NSPrincipalClass")) | |
(progname (#/objectForKey: info #@"CFBundleName"))) | |
(when (%null-ptr-p classname) | |
(setq classname #@"NSApplication")) | |
(unless (%null-ptr-p progname) | |
(#/setProcessName: (#/processInfo ns:ns-process-info) progname)) | |
(let* ((appclass (#_NSClassFromString classname)) | |
(app (#/sharedApplication appclass))) | |
(when (%null-ptr-p app) | |
(error "Could not create shared instance of ~s" (%get-cfstring | |
classname))) | |
app)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment