[Openmcl-devel] Determining OSX version at runtime

Raffael Cavallaro raffaelcavallaro at mac.com
Fri Aug 27 07:22:06 PDT 2010


On Aug 27, 2010, at 10:12 AM, Raffael Cavallaro wrote:

> (defun framework-loaded-p (framework-namestring) ;; case sensitive
>  (let* ((frameworks (#/allFrameworks ns:ns-bundle)))
>    (loop for i below (#/count frameworks)
>      for current-framework = (ccl::lisp-string-from-nsstring
>                               (#/bundleIdentifier (#/objectAtIndex: frameworks i)))
>      when (search framework-namestring current-framework)
>      return current-framework)))

probably want to do that in an autorelease pool so we don't leak an NSArray and a bunch of NSStrings:

(defun framework-loaded-p (framework-namestring) ;; case sensitive
  (ccl::with-autorelease-pool
      (let* ((frameworks (#/allFrameworks ns:ns-bundle)))
        (loop for i below (#/count frameworks)
          for current-framework = (ccl::lisp-string-from-nsstring
                                   (#/bundleIdentifier (#/objectAtIndex: frameworks i)))
          when (search framework-namestring current-framework)
          return current-framework))))

warmest regards,

Ralph


Raffael Cavallaro
raffaelcavallaro at me.com








More information about the Openmcl-devel mailing list