Changeset 6743


Ignore:
Timestamp:
Jun 16, 2007, 7:15:23 PM (17 years ago)
Author:
Gary Byers
Message:

Use a prototype info.plist, touch the kernel, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ide-1.0/ccl/examples/fake-cfbundle-path.lisp

    r156 r6743  
    1111;;; before the CoreFoundation library's initialized.
    1212
    13 (defun fake-cfbundle-path (executable-path)
    14   (when executable-path
    15     (unless (probe-file executable-path)
    16       (cerror "Create an empty file."
    17               "The specified executable path (~s) doesn't exist"
    18               executable-path)
    19       (create-file executable-path))
    20     (let* ((fakepath
    21             (native-translated-namestring executable-path)))
    22       (setenv "CFProcessPath" fakepath))))
     13(defun fake-cfbundle-path (bundle-root)
     14  (let* ((kernel-name (standard-kernel-name))
     15         (needle "OPENMCL-KERNEL")
     16         (translated-root (translate-logical-pathname bundle-root))
     17         (executable-path (merge-pathnames
     18                           (make-pathname :directory "Contents/MacOS/"
     19                                          :name kernel-name)
     20                           translated-root))
     21         (info-plist-proto-path (merge-pathnames "Contents/Info.plist-proto"
     22                                                 translated-root)))
     23    (unless (probe-file info-plist-proto-path)
     24      (error "Can't find Info.plist prototype in ~s" info-plist-proto-path))
     25    (with-open-file (in info-plist-proto-path
     26                        :direction :input
     27                        :external-format :utf-8)
     28      (with-open-file (out (make-pathname :directory (pathname-directory info-plist-proto-path)
     29                                          :name "Info"
     30                                          :type "plist")
     31                           :direction :output
     32                           :if-does-not-exist :create
     33                           :if-exists :supersede
     34                           :external-format :utf-8)
     35        (do* ((line (read-line in nil nil) (read-line in nil nil)))
     36             ((null line))
     37          (let* ((pos (search needle line)))
     38            (when pos
     39              (setq line
     40                    (concatenate 'string
     41                                 (subseq line 0 pos)
     42                                 kernel-name
     43                                 (subseq line (+ pos (length needle)))))))
     44          (write-line line out))))
     45    (touch executable-path)
     46    (setenv "CFProcessPath" (native-translated-namestring executable-path))))
Note: See TracChangeset for help on using the changeset viewer.