[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Opening files from the finder after mclv2.0's started

I'm interested in doing this and I don't remember if someone else's
posted a solution (I remember there was a recent request about it but
I spaced it). After a little exploring I determined
ccl::open-application-document is called when I open files from the
Finder that have ccl2 as their creator. Folling is a file that opens
one of my object files if the arg passed to
ccl::open-application-document is appropriate.

- Is is the (or an) Apple/MCL-approved solution?
- What is the optional mystery arg?
- Is the application instance every different from *application* and
are there ever subclasses of it? (It seems defining methods on the
application class is somewhat useless; in fact the only method mcl
defines is on T, not APPLICATION.)

;;; finder-open-object-file.lisp

Purpose ========================================================
Defines an ccl::open-application-document :after method that opens IKit


(defmethod ccl::open-application-document :after ((application t)
                                                  (pathname pathname)
                                                  &optional optional-mystery-arg)
  "An after method that calls open-object-file on pathname if it's an object file."
  (declare (optimize speed)
           (ignore optional-mystery-arg))
  (let* ((kw-mac-file-type (mac-file-type pathname))
         (f-wood-file (eq kw-mac-file-type :|WOOD|))
         (f-object-file nil))
    ;; Set f-object-file.
    (when f-wood-file
      (with-open-pheap (pheap pathname)
        (setf f-object-file (ps::f-ikit-pheap pheap))))
    (when f-object-file
      (ps::open-object-file pathname))))