Re: Problem opening file
Re: Problem opening file
- Subject: Re: Problem opening file
- From: Carlos Eduardo Mello <email@hidden>
- Date: Tue, 22 Feb 2011 18:01:47 -0300
On Feb 22, 2011, at 1:46 PM, Scott Ribe wrote:
On Feb 22, 2011, at 9:14 AM, Sherm Pendley wrote:
I imagine I have to deal
with application bundle api, but the thing is I can't add any
cocoa code to
this library, as it needs remain cross-platform.
Does this library allow you to specify the full path to its config
file, instead of just its name, when you initialize the library? If
so, you could keep the platform-specific code outside of the library
itself.
Alternatively, you could use NSBundle methods to find the location of
your executable, then chdir() to that directory before initializing
the library.
Also, although I don't know that it really matters other than style
& consistency, but next to the executable is not where such a file
would normally be put in an app bundle. The "Resources" folder in
the bundle is more appropriate--assuming here that you're building a
regular bundled app and not just a command-line executable...
Thank you both.
I put my file in Contents/Resources/ and passed the path to my
internal library. Two lines did the trick:
NSString * nsPath = [ [NSBundle mainBundle] pathForResource:@"comp"
ofType:@"slf"];
string cppPath = [nsPath UTF8String];
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden