• 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: Find app's working directory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Find app's working directory


  • Subject: Re: Find app's working directory
  • From: Sherm Pendley <email@hidden>
  • Date: Mon, 5 Jan 2004 11:03:52 -0500

On Jan 5, 2004, at 10:11 AM, Sam Carr wrote:

On 5 Jan 2004, at 2:43 pm, Chad Armstrong wrote:

Perhaps I'm just remembering something, but I'm trying to retrieve the current running directory of my application.

You should be able to use:

NSString *appPath = [NSBundle mainBundle];

Perhaps I'm mis-interpreting the question, but I don't think that's what Chad is after. That will give the path to the .app wrapper, but it appears to me that Chad wants the current working directory. In other words, he wants the directory from which relative paths will be resolved.

The answer to *that* question is "/" when your app is started from Finder, and the build directory when it's started from PB/XCode. As far as I know, neither is guaranteed, so the best thing to do is to specify fully-qualified paths.

sherm--
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Find app's working directory (From: Chad Armstrong <email@hidden>)
 >Re: Find app's working directory (From: Sam Carr <email@hidden>)

  • Prev by Date: Re: Intercepting JavaScript calls in WebViews
  • Next by Date: Updating an NSView
  • Previous by thread: Re: Find app's working directory
  • Next by thread: Re: Find app's working directory
  • Index(es):
    • Date
    • Thread