Set working dir to /.../

Posted on 2004-10-10
Last Modified: 2013-12-26
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 /.../

Thank you!
Question by:Daij-Djan
  • 2
  • 2
LVL 23

Accepted Solution

brettmjohnson earned 125 total points
ID: 12272074
Use the CFBundle APIs to determine the location of the bundle's Resources directory:
Specifically, CFBundleGetMainBundle() and CFBundleCopyResourcesDirectoryURL().

Use CFURLGetFileSystemRepresentation() to convert the returned URL to a file system path.

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


Author Comment

ID: 12276587
the CorFoundation is objective C, no? can I simply call it from a c 'tool'

Author Comment

ID: 12276616
LVL 23

Expert Comment

ID: 12277331
> the CorFoundation is objective C, no? can I simply call it from a c 'tool'

No, CoreFoundation is ANSI C.


Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Tab names are off by one 5 54
Shell script to login to remote m/c and execute commands 10 78
string initialization in java 11 114
Authenticate using sesu from script 7 36
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question