Created an Irrlicht project with Code::Blocks on Windows. When I try to read an XML file located in the same directory as the executable I notice that the working directory is "C:\irrlicht\bin\Win32-gcc", that is, the directory where the Irrlicht.dll is located. On MacOS X I'm pertty sure that the working directory is the application's directory.
That is no problem as long as I can change the working directory, which I can do with irr::io::IFileSystem. However, I don't want to hardcode a path to the executable. How do I get the path to the running executable on Windows? I can't find any method in irr::io::IFileSystem to do that!
[Win] Executable's working directory?
one question are you running the executeable out of code::blocks? if yes, check at project settings "execution directory"
greets,
halan
greets,
halan
My Blog: http://www.freakybytes.org
Re: [Win] Executable's working directory?
I just found out that the problem is that Code::Blocks has a setting called Execution working directory (Project/Target options). The Irrlicht project template sets this value to "C:\irrlicht\bin\Win32-gcc". It has nothing to do with Irrlicht. Irrlicht is, of course, using the executable's directory as the default working directory, just like on Mac.jonasled wrote:Created an Irrlicht project with Code::Blocks on Windows. When I try to read an XML file located in the same directory as the executable I notice that the working directory is "C:\irrlicht\bin\Win32-gcc", that is, the directory where the Irrlicht.dll is located. On MacOS X I'm pertty sure that the working directory is the application's directory.
IMHO the C::B project template should execute the application in the project directory. It makes no sense to use "C:\irrlicht\bin\Win32-gcc"! However, that I should probably report in the CB forum. I just posted this to save someone else a few hours, which could have been better spent on coding!
It would still be nice to know how to get the path to the running executable in Windows.