[futurebasic] Re: [FB] Set filetype, creatortype

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 2004 : Group Archive : Group : All Groups

From: Brian Stevens <brilor@...>
Date: Fri, 7 May 2004 16:42:33 -0700
How about the following---may not be perfect....

// In Toolbox structure

'begin record FInfo
'dim fdType     as OSType/*the type of the file*/
'dim fdCreator  as OSType/*file's creator*/
'dim fdFlags    as unsigned short/*flags ex.  
hasbundle,invisible,locked, etc.*/
'dim fdLocation as point/*file's location in folder -- pixel position  
as point*/
'dim fdFldr     as short/*folder containing file*/
'end record


CLEAR LOCAL MODE
LOCAL FN SetTypeCreator(type as OSType, creator as OSType, mySpecPtr as  
^FSSpec)
DIM Err as OSerr
dim @ myFileInfo   as FInfo
Err = fn FSpGetFInfo (#mySpecPtr,myFileInfo)
myFileInfo.fdType = type
myFileInfo.fdCreator = creator
Err = FN FSpSetFInfo (#mySpecPtr,myFileInfo)
END FN = Err

dim mySpec as FSSpec
DIM anErr as OSerr
long if len(files$(_FSSpecOpen,"","",mySpec))
anErr = FN SetTypeCreator(_"TEXT",_"TTRO",mySpec)
end if

On May 6, 2004, at 7:10 AM, michael evans wrote:

> Hello all
>
> In subs files.incl there is a function:
>
> LOCAL
> DIM ioErr%
> dim dirsave&
> dim tempPB;128
> LOCAL FN FBSetFileType(pb&,FType&,CType&)
> tempPB;128 = pb&
> tempPB.ioFVersNum`  = 0
> tempPB.ioFDirIndex% = 0
> dirsave&            = tempPB.ioDirID&'Date { 12/28/01 }
> ioErr = FN PBHGetFInfoSync(@tempPB)
> LONG IF ioErr = _noErr
> tempPB.ioDirID&    = dirsave&'Date { 12/28/01 }
> tempPB.ioFVersNum` = 0
> tempPB.ioFDirIndex%= 0
> tempPB.ioFlUsrWds.fdCreator&= CType&
> tempPB.ioFlUsrWds.fdType&   = FType&
> ioErr = FN PBHSetFInfoSync(@tempPB)
> END IF
> END FN = ioErr%
>
>
> If I want to set a file to be a photoshop jpeg file then
> FType& = _"JPEG" and CType& = _"8BIM"
>
> What I can't figure out is how to get a file's pb& in osx to pass to  
> the fn
> above...
>
> Any help would be appreciated...
>
>
> Cheers,
>
> ----------------------------------------------------------------------- 
> -----
> Michael Evans
> ----------------------------------------------------------------------- 
> -----
>
> --
>