Way to retrieve creator-type of OS X files?

Richard Gaskin ambassador at fourthworld.com
Thu Sep 16 07:04:34 EDT 2004


Robert Brenstein wrote:
> Theoretically, you should be able to use Rinaldi's externals GetFInfo 
> and SetFInfo. I say theoretically because GetFInfo causes a hard crash 
> and both Frederic and RunRev folks blame the other (see bug 855). 
> Furthermore, there are no OSX versions of those externals.
> 
> IMHO it would be reasonable to support platform-specific features like 
> these through an external.

Simple enough to script -- I wrote this one to get just the file type, 
but could easily be extended to include creator code:


function fwMacFileType pPath
   local tSaveDir, tShortFileName, tFileList, tLine, tType
   --
   put the directory into tSaveDir
   set the itemdel to "/"
   put the last item of pPath into tShortFileName
   delete last item of pPath
   set the directory to pPath
   put the detailed files into tFileList
   put lineoffset(cr&urlEncode(tShortFileName)&comma, cr&tFileList&comma)
  into tLine
   if tLine > 0 then
     set the itemdel to comma
     put last item of line tLine of tFileList into tType
   end if
   set the directory to tSaveDir
   return tType
end fwMacFileType



-- 
  Richard Gaskin
  Fourth World Media Corporation
  ___________________________________________________________
  Ambassador at FourthWorld.com       http://www.FourthWorld.com


More information about the use-livecode mailing list