Irrlicht working from called folder, not application folder

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
torleif
Posts: 188
Joined: Mon Jun 30, 2008 4:53 am

Irrlicht working from called folder, not application folder

Post by torleif »

When I call my executable file from another folder, such as:

"c:\example\file.exe"

When I am in c:, the program looks for files in c:. It never used to do this until I installed some new software (MS WiX, to be exact).

I think it's a bug on my computer, not irrlicht. It's the same when I compile in both g++ and MSVS.

Am I right, or is it irrlicht?

if it is irrlicht, is there a work around?
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

It will always look for files in its current directory that it's launched from, i'm surprised that you've ever seen any other behaviour. Other behaviour would make it very hard to actually release the game to anyone else!
Image Image Image
torleif
Posts: 188
Joined: Mon Jun 30, 2008 4:53 am

Post by torleif »

JP: Ah, so it's not my computer? and yes, I'm trying to create a simple msi installer so other people can play it :D

I'm using relative "files\", not absolute paths "c:\game\files\" so that's not the problem.

A solution would simply be to set changeWorkingDirectoryTo() to the folder where the .exe exists. getWorkingDirectory() returns the folder where the exe was called from

Is there a way to get the folder where the .exe lies?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You can just edit the program file's properties and set the working directory. Since you'll use an installer you can do such stuff in there.
torleif
Posts: 188
Joined: Mon Jun 30, 2008 4:53 am

Post by torleif »

*slaps forehead* I feel like an idiot now, I had no idea shortcuts did that.

Thanks hybrid, you truly are a legend.

I have switched to Inno (fantastic program, highly recommend it) because it was more flexible than the windows counterpart. The solution to adding base directories is in their wiki, and now my installer works great.

Now the only thing left is to spit shine my game then other people can enjoy it :D
Post Reply