Re: Where am I if I'm a .App package?
Re: Where am I if I'm a .App package?
- Subject: Re: Where am I if I'm a .App package?
- From: Sherm Pendley <email@hidden>
- Date: Tue, 4 Oct 2005 00:53:44 -0400
On Oct 4, 2005, at 12:34 AM, 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
NSString *appDir = [[NSBundle mainBundle] bundlePath];
, so say I'm a running program, and I want to access a settings
file located in the same directory where _I_ am located
What exactly to you mean by "access"? That directory may not be
writable by the user running the app. Anyway, you should be using
NSUserDefaults to manage settings. That's what it's for.
If you want to read the default settings from a plist or other read-
only file, you should store that in the .app bundle as a resource -
but you don't need to know the .app path to get at resources, you can
simply use one of NSBundle's -getPathForResource* methods to get that.
-- or I have customizable media I want to load that's stored in a
"media" directory alongside myself
Nothing should be in /Applications except application .app bundles.
External files - templates, media, etc. is what the "/Library/
Application Support" directory is for.
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
_______________________________________________
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