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

Re: System Folder



At 8:41 PM 4/23/95, Rick Dukes wrote:
>How can I get the pathname for the System Folder?
>I found (#_FindFolder #$konsystemdisk #$ksystemfoldertype
>#$KDontCreateFolder vrefnum dirid), but I can't find a way turn coerce
>vrefnum and dirid into a pathname.  Thanks,
>
>Rick

Try the following:

(in-package :ccl)

(export 'find-folder)

(defun find-folder (folder-signature &optional (createp t))
  ;;folder types are documented in Inside Mac Volume VI, The Finder Interface
  (let* ((can-do? (gestalt "fold")))
    (when (and can-do?
               (plusp can-do?))
      (%stack-iopb (pb name)
        (#_FindFolder -1 folder-signature createp 
         (%inc-ptr pb 22)               ; $ioVRefNum
         (%inc-ptr pb 48))              ; $ioDirId
        (make-pathname :directory 
                       (pathname-directory (%path-from-iopb pb)))))))

;(find-folder #$ksystemfoldertype)
;#P"HD:System Folder:"

- Steve Hain

Digitool, Inc.
______________________________________________________________________________
                       One Main Street   7th Floor   Cambridge, MA 02142   USA
                              Internet: slh@digitool.com   AppleLink: digitool
                                      World Wide Web: http://www.digitool.com/
                                         Tel: 617 441-5000   Fax: 617 576-7680