• 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: NSOpenPanel -runModalForDirectory:file:types: won't select file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOpenPanel -runModalForDirectory:file:types: won't select file


  • Subject: Re: NSOpenPanel -runModalForDirectory:file:types: won't select file
  • From: Roland Torres <email@hidden>
  • Date: Fri, 20 Apr 2007 09:34:40 -0700


On Apr 20, 2007, at 6:32 AM, Johan Kool wrote:

Roland,

Op 19-apr-2007, om 21:24 heeft Roland Torres het volgende geschreven:

I can't get NSOpenPanel's -runModalForDirectory:file:types: to preselect a file.

[[NSOpenPanel openPanel] runModalForDirectory:@"/Users/roland/ chem" file:@"Hexachlorophene_37b.dat" types:nil];

My guess would be that the directory should be /Users/roland/chem/, you omitted the last slash "/".


If you use the methods -stringByDeletingLastPathComponent and - lastPathComponent you are less likely to make such mistakes:

NSString *filePath = @"/Users/roland/chem/Hexachlorophene_37b.dat";
int result = [oPanel runModalForDirectory:[filePath stringByDeletingLastPathComponent]
file:[filePath lastPathComponent]
types:nil];

Hi Johan,

No, this does not make a difference. I guess this is a bug in OS X.

Roland

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: NSOpenPanel -runModalForDirectory:file:types: won't select file
      • From: Johan Kool <email@hidden>
References: 
 >NSOpenPanel -runModalForDirectory:file:types: won't select file (From: Roland Torres <email@hidden>)
 >Re: NSOpenPanel -runModalForDirectory:file:types: won't select file (From: Johan Kool <email@hidden>)

  • Prev by Date: Re: NSDocumentController recentDocumentURLs hiding non-file based URLs
  • Next by Date: Re: [Cocoa] How convert ":Developer:Private:jam" into a path POSIX-style
  • Previous by thread: Re: NSOpenPanel -runModalForDirectory:file:types: won't select file
  • Next by thread: Re: NSOpenPanel -runModalForDirectory:file:types: won't select file
  • Index(es):
    • Date
    • Thread