[futurebasic] Re: [FB] Temporary Items folder

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2012 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Mon, 9 Jan 2012 22:56:51 +1300
Robert Covington wrote:

> include "Util_FileDirectory.incl"
> dim err as OSStatus
> dim as FSSpec outSpec
> err = fn FD_SpecialDirectoryGetFSSpec( _kUserDomain, _kTemporaryFolderType, @outSpec )
> 
> err = Fn FSMakeFSSpec(outSpec.vRefnum, outSpec.parID, "TestFile4?", @outSpec)
>  
> Open "A",1,@outSpec
> Print #1, "Test4"
> Close #1
> 
> Will create the file 'TestFile4' in Caches. That seems like incorrect behavior.

There are two forms of FSSpec for a folder. Either 
   .name has length zero and .parID is the folder itself
or 
   .name has length > 0 and .parID is the parent.

FD_SpecialDirectoryGetFSSpec() returns the second form.
To get a file in the TemporaryItems folder:
err = Fn FSMakeFSSpec(outSpec.vRefnum, outSpec.parID, outSpec.name + ":" + "TestFile4?", @outSpec)

Robert P.