Page 1 of 1

Irrlicht working from called folder, not application folder

Posted: Mon Aug 25, 2008 11:16 am
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?

Posted: Tue Aug 26, 2008 7:48 am
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!

Posted: Tue Aug 26, 2008 11:12 am
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?

Posted: Tue Aug 26, 2008 11:14 am
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.

Posted: Tue Aug 26, 2008 11:32 am
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