• 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: Douglas Davidson <email@hidden>
  • Date: Mon, 5 Jan 2004 10:16:39 -0800

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

NSString *appPath = [NSBundle mainBundle];

Er, [[NSBundle mainBundle] bundlePath] for the path to the app itself, then if you wish use stringByDeletingLastPathComponent to get the directory it lives in. However, that's where the app lives, which is not what is usually called the "working directory". The latter term usually refers to the current working directory, which is [[NSFileManager defaultManager] currentDirectoryPath]. Cocoa apps usually do not need to refer to the cwd; it's primarily for command-line tools, which often use it as an implicit argument. The cwd and the app's path have no necessary connection.

Douglas Davidson
_______________________________________________
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: NSBox subview size
  • Next by Date: Re: printing the standard output in a NSTextview
  • Previous by thread: Re: Find app's working directory
  • Next by thread: Updating an NSView
  • Index(es):
    • Date
    • Thread