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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to