Re: Relative pathnames e.g. when initializing NSImages?
Re: Relative pathnames e.g. when initializing NSImages?
- Subject: Re: Relative pathnames e.g. when initializing NSImages?
- From: email@hidden
- Date: Sat, 11 May 2002 16:37:52 +0200
On samedi, mai 11, 2002, at 04:14 , Nathan Groh wrote:
When using NSImage's initWithContentsOfFile: method, I'm forced to
use an absolute pathname. A standard Unix relative pathname invariably
fails. Is there some special Darwin voodoo regarding relative paths
that I'm in the dark about? I've tried both a relative path from the
application, e.g. @"Graphics/image.tiff" where Graphics is the folder
containing the app's images, and a relative path from the user's home
directory e.g. @"~/Application/Graphics/image.tiff". Both paths fail to
initialize the NSImage successfully, and I'm forced to use a path like
@"/Users/theuser/Application/Graphics/image.tiff". Obviously I'm
missing something. Can someone shed some light on the situation for me?
Fiat lux. : )
1 quick suggestion:
Use [@"~/Application/Graphics/image.tiff" stringByExpandingTildeInPath]
Another suggestion:
Use the App bundle to store your images, it will allow you to use
[NSImage imageNamed:];
_______________________________________________
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.