• 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: Where am I if I'm a .App package?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where am I if I'm a .App package?


  • Subject: Re: Where am I if I'm a .App package?
  • From: Dan Treiman <email@hidden>
  • Date: Mon, 3 Oct 2005 23:59:06 -0500

If I'm understanding your question right, you can use [[NSBundle mainBundle] bundlePath] (read NSBundle API reference) to find the path of your application bundle. then use NSString's stringByDeletingLastPathComponent to go up one directory to the directory containing the application.

However, for most cocoa apps it is better to store resources inside the application bundle,
or store them in the user's application support folder if they are user-specific resources. Alternatively, if these settings are user- specific preferences, then they should be in ~/Library/Preferences.


    hope I answered some of your question
    -Dan

On Oct 3, 2005, at 11:34 PM, Scott Harper wrote:

I would like to know how I can (hopefully there's an easy way) discover the path to the currently running .app's directory, so say I'm a running program, and I want to access a settings file located in the same directory where _I_ am located -- or I have customizable media I want to load that's stored in a "media" directory alongside myself, how can I get that file, if I'm in an arbitrary location?

Thanks, and I hope this made sense.

--Scott
_______________________________________________
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


_______________________________________________ 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
  • Follow-Ups:
    • Re: Where am I if I'm a .App package?
      • From: Sherm Pendley <email@hidden>
References: 
 >Where am I if I'm a .App package? (From: Scott Harper <email@hidden>)

  • Prev by Date: Re: Where am I if I'm a .App package?
  • Next by Date: Re: Where am I if I'm a .App package?
  • Previous by thread: Re: Where am I if I'm a .App package?
  • Next by thread: Re: Where am I if I'm a .App package?
  • Index(es):
    • Date
    • Thread