Changeset 6846


Ignore:
Timestamp:
Jul 18, 2007, 5:05:42 AM (13 years ago)
Author:
gb
Message:

Check for Tiger at application startup.
Assume that preferences mechanism will init CCL dir.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ide-1.0/ccl/examples/cocoa-application.lisp

    r6813 r6846  
    2626;;; that it -should- work.
    2727
    28 ;;; This is a hack to try to set the CCL logical host's translations
    29 ;;; appropriately.  If the environment variable CCL_DEFAULT_DIRECTORY
    30 ;;; is set, assume that it's correct and do nothing.  Otherwise, if
    31 ;;; there's a key #@"CCLDefaultDirectory" in the main bundle's Info.plist,
    32 ;;; use it and the bundle's path to set CCL_DEFAULT_DIRECTORY and
    33 ;;; setup the CCL logical host translations again.
    34 (defun reset-ccl-directory ()
    35   (or (getenv "CCL_DEFAULT_DIRECTORY")
    36       (with-autorelease-pool
    37           (let* ((bundle (#/mainBundle ns:ns-bundle))
    38                  (ccl-dir (unless (%null-ptr-p bundle)
    39                             (#/objectForInfoDictionaryKey: bundle
    40                                   #@"CCLDefaultDirectory")))
    41                  (bundle-path (unless (%null-ptr-p bundle)
    42                                 (#/bundlePath bundle))))
    43             (when (and ccl-dir (not (%null-ptr-p ccl-dir))
    44                        bundle-path (not (%null-ptr-p bundle-path)))
    45               (let* ((bundle-string (lisp-string-from-nsstring bundle-path))
    46                      (ccl-string (lisp-string-from-nsstring ccl-dir))
    47                      (bundle-len (length bundle-string)))
    48                 (if (and (> bundle-len 0)
    49                          (not (eql (schar bundle-string (1- bundle-len)) #\/)))
    50                   (setq bundle-string (concatenate 'string bundle-string "/")))
    51                 (let* ((default-dir (native-translated-namestring
    52                                      (merge-pathnames ccl-string bundle-string))))
    53                   (setenv "CCL_DEFAULT_DIRECTORY" default-dir t)
    54                   (init-logical-directories))))))))
     28
    5529
    5630
     
    6842;;; bit better ... I'd tend to agree.)
    6943(defmethod parse-application-arguments ((a cocoa-application))
    70   (values nil nil nil))
     44  (values nil nil nil nil))
    7145
    7246(defmethod toplevel-function ((a cocoa-application) init-file)
    7347  (declare (ignore init-file))
    74   (call-next-method)
    75   (reset-ccl-directory)
     48  (when (< #&NSAppKitVersionNumber 824)
     49    (#_NSLog #@"This application requires features introduced in OSX 10.4.")
     50    (#_ _exit -1))
     51  (setq *standalone-cocoa-ide* t)
    7652  (start-cocoa-application))
    7753
Note: See TracChangeset for help on using the changeset viewer.