• 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: Launching Cocoa Application externally
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Launching Cocoa Application externally


  • Subject: Re: Launching Cocoa Application externally
  • From: "Sherm Pendley" <email@hidden>
  • Date: Thu, 15 May 2008 12:56:09 -0400

On Thu, May 15, 2008 at 12:42 PM, Yann Disser <email@hidden> wrote:

> Thank you all for your help. I managed to fix the problem by going over
> your suggestions.
>
> The problem was that I access a file (without proper error-handling; I will
> add that now :-)). The default working directory is the main-bundle path
> when run from within XCode and it is "/" when run from Finder.
>
> I repaired this by adding
> [[NSFileManager defaultManager] changeCurrentDirectoryPath:
>    [[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent]];
> to my awakeFromNib. I hope this works as I intend.


You shouldn't rely on the current working directory. Just use the call to
-bundlePath (or one of NSBundles many other methods for finding paths to
different bundle internals) to create a fully-qualified path to the file you
want to open.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________

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

References: 
 >Re: Launching Cocoa Application externally (From: Yann Disser <email@hidden>)

  • Prev by Date: iPhone: Question about keyboard / drawing
  • Next by Date: Re: iPhone: Question about keyboard / drawing
  • Previous by thread: Re: Launching Cocoa Application externally
  • Next by thread: Re: Launching Cocoa Application externally
  • Index(es):
    • Date
    • Thread