Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Trouble with FindFolder kTemporaryFolderType
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble with FindFolder kTemporaryFolderType




On Jun 3, 2006, at 3:03 PM, Dan Berghult wrote:

Hi,


I have noticed that Apple has changed the behavior of FindFolder(). I think the change came with 10.4.



My problem is that the TemporaryItems folder isn't recreated by FindFolder() if the Temporary Items folder is deleted.


In 10.4.x it won't. In 10.3.6 it does. I think it worked in 10.3.9 as well but after one of the Security patches I suspect that 10.3.9 beahves as 10.4.x regarding this issue.


What I do test this:


FindFolder(kTemporaryFolderType);

   Use the folder for something.

   Delete the temporary folder manually.

Execute FindFolder(kTemporaryFolderType); //Here FindFolder() return NoErr
but it does'nt create the folder as it i supposed to do, and did in 10.3.6.



Note that if I quit my test app and launch it again FindFolder() will create the folder.
It looks like an app only can create the temporary folder once and once only.




I'm not sure if this is a bug or if I have missed something in the documentation.

It's not a bug, but a caching issue that's been discussed here in the past. This is the code I use. I seem to recall that I ask for the chewable items folder because it gets emptied at different times than the temp items folder, but the issue is the same.


OSStatus GetTemporaryItemsFolder( FSRef &outTemporaryItemsFolder )
{
OSStatus err = FSFindFolder( kOnAppropriateDisk, kChewableItemsFolderType, kCreateFolder,
&outTemporaryItemsFolder );
if ( err == noErr && !FSRefIsValid( outTemporaryItemsFolder ) )
{
InvalidateFolderDescriptorCache( 0, 0 );
err = FSFindFolder( kOnAppropriateDisk, kChewableItemsFolderType, kCreateFolder,
&outTemporaryItemsFolder );
}

if ( err )
err = FSFindFolder( kOnAppropriateDisk, kTemporaryFolderType, kCreateFolder,
&outTemporaryItemsFolder );
return err;
}


Larry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Trouble with FindFolder kTemporaryFolderType (From: Dan Berghult <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.