Re: Finder refresh issue in Mac OS 10.5
Re: Finder refresh issue in Mac OS 10.5
- Subject: Re: Finder refresh issue in Mac OS 10.5
- From: James Walker <email@hidden>
- Date: Tue, 11 May 2010 10:22:48 -0700
On 5/10/2010 7:36 AM, Sachin Porwal wrote:
I also tried using noteFileSystemChanged after creating the shortcut :
Try sending a kAESync event to the Finder. Here's my code to do it.
Note that although this is Carbon code, it will compile for the x86_64
architecture. Use CFURLGetFSRef to go from an NSURL* to an FSRef.
#import <Carbon/Carbon.h>
/*!
@function SendFinderSyncEvent
@abstract Send an Apple event to the Finder to update the display
of the item specified.
@param inObjectRef A reference to a file or folder.
@result An OS error code.
*/
OSStatus SendFinderSyncEvent( const FSRef* inObjectRef )
{
AppleEvent theEvent = { typeNull, NULL };
AppleEvent replyEvent = { typeNull, NULL };
AliasHandle itemAlias = NULL;
const OSType kFinderSig = 'MACS';
OSStatus err = FSNewAliasMinimal( inObjectRef, &itemAlias );
if (err == noErr)
{
err = AEBuildAppleEvent( kAEFinderSuite, kAESync,
typeApplSignature, &kFinderSig, sizeof(OSType),
kAutoGenerateReturnID, kAnyTransactionID, &theEvent,
NULL, "'----':alis(@@)", itemAlias );
if (err == noErr)
{
err = AESendMessage( &theEvent, &replyEvent, kAENoReply,
kAEDefaultTimeout );
AEDisposeDesc( &replyEvent );
AEDisposeDesc( &theEvent );
}
DisposeHandle( (Handle)itemAlias );
}
return err;
}
--
James W. Walker, Innoventive Software LLC
<http://www.frameforge3d.com/>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden