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

How to find System folder?



I'm using the find-special-folder to find #$kPreferencesFolderType.
It works fine in System 7 but gives "unimplemented trap" error in
System 6.07. How to make it running in both?

(defun find-special-folder (type &optional (create-p t))
  (let ((kCreate (if create-p #$kCreateFolder #$kDontCreateFolder)))
    (rlet ((vrefnum_p :Integer)
           (foundDirId_p :LongInt)
           (fsSpec_p  :FSSpec)
          )
      (#_FindFolder #$kOnSystemDisk type kCreate vrefnum_p foundDirId_p)
      (with-pstrs ((empty_cstr ""))
          (#_FSMakeFSSpec
            (%get-word vrefnum_p)
            (%get-long foundDirId_p)
            empty_cstr
            fsSpec_p
      ) )
      (%path-from-fsSpec fsSpec_p)
) ) )

Peter