Set working dir to /.../mybundle.app/Resources

I am having a Linux-Source which expects files in ./ relative to its executable... in order to change as little as possible I want to set working dir of my bundle to /.../mybundle.app/Resources.

Thank you!
LVL 5
Daij-DjanAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
brettmjohnsonConnect With a Mentor Commented:
Use the CFBundle APIs to determine the location of the bundle's Resources directory:
Specifically, CFBundleGetMainBundle() and CFBundleCopyResourcesDirectoryURL().
http://developer.apple.com/documentation/CoreFoundation/Reference/CFBundleRef/index.html

Use CFURLGetFileSystemRepresentation() to convert the returned URL to a file system path.
http://developer.apple.com/documentation/CoreFoundation/Reference/CFURLRef/Reference/function_group_3.html

Use chdir() to set the current working directory for the benefit of your ported Linux code.
man 2 chdir

0
 
Daij-DjanAuthor Commented:
the CorFoundation is objective C, no? can I simply call it from a c 'tool'
0
 
Daij-DjanAuthor Commented:
nevermind
0
 
brettmjohnsonCommented:
> the CorFoundation is objective C, no? can I simply call it from a c 'tool'

No, CoreFoundation is ANSI C.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.