• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Finder refresh issue in Mac OS 10.5
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Finder refresh issue in Mac OS 10.5
      • From: Sachin Porwal <email@hidden>
References: 
 >Finder refresh issue in Mac OS 10.5 (From: Sachin Porwal <email@hidden>)

  • Prev by Date: Pagination of linear content
  • Next by Date: Re: App won't launch in Debug but release product is fine
  • Previous by thread: Re: Finder refresh issue in Mac OS 10.5
  • Next by thread: Re: Finder refresh issue in Mac OS 10.5
  • Index(es):
    • Date
    • Thread