IrrXMLReader and Unix paths

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Wako
Posts: 4
Joined: Wed Jan 14, 2009 8:16 pm

IrrXMLReader and Unix paths

Post by Wako »

I used the tutorial on irrXML's website:

Code: Select all

IrrXMLReader* xml = createIrrXMLReader("../../../config/preferences.xml");
When I compile and test in XCode, the Working directory is where the executable is, and thus this line worked. However, when I run the .app, the Working Directory is set to "/", and I believe that cerateIrrXMLReader doesn't automatically use the relative path (unlike getTexture).

My question is, how do I use the XML reader using relative paths? I want to create the Driver after, because the XML will contain the screen resolution, color depth, etc.

Thanks :)
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

You can get the path to the executable from the first argument passed to your main function-

Code: Select all

int main(int argc, char **argv)
argv[0] will contain the full path to your .app, so you can strip the app name off and set the working directory before opening the xml
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Post Reply