• 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: unreliability of NSWorkspace selectFile
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unreliability of NSWorkspace selectFile


  • Subject: Re: unreliability of NSWorkspace selectFile
  • From: Mike Wright <email@hidden>
  • Date: Sat, 4 Mar 2006 07:38:42 -0600

On Mar 4, 2006, at 00:13, Matt Neuburg <email@hidden> m wrote:

Message: 3
Date: Fri, 03 Mar 2006 14:56:53 -0800
From: Matt Neuburg <email@hidden>
Subject: unreliability of NSWorkspace selectFile
To: <email@hidden>
Message-ID: <C02E09B5.134CE%email@hidden>
Content-Type: text/plain;	charset="US-ASCII"

I would like to reliably reveal *and* select a file/folder in the Finder.

I am using [[NSWorkspace sharedWorkspace] selectFile:path
inFileViewerRootedAtPath:folder].

It isn't reliable. Sometimes it selects the file; sometimes it selects the
containing folder instead. I've also tried issuing the command *twice*;
sometimes this solves the problem (now it selects the file) and opens only
one Finder window, other times it causes two Finder windows to open.


Does this match the observations of others? I think I might be able to work
around this by substituting Apple events, but it's more work, of course...
m.


--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>

Here's what iData 2.2 will have, which seems to work consistently, even across the ethernet:


- (IBAction)revealInFinder:(id)sender
{
NSString *path = [[[self document] fileURL] path];
[[NSWorkspace sharedWorkspace] selectFile:path inFileViewerRootedAtPath:nil];
}


Are you passing nil, @"", or something else as the last parameter? (Not that I know what difference it would make. I'm sure I stole this little bit of code from some sample code, though I don't recall where.)
__
Mike Wright
email@hidden
http://www.raccoonbend.com
http://idata2.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Prev by Date: Re: NSSlider mouseUp ????
  • Next by Date: Parsing a packet Async Socket
  • Previous by thread: Re: unreliability of NSWorkspace selectFile
  • Next by thread: Re: unreliability of NSWorkspace selectFile
  • Index(es):
    • Date
    • Thread