News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Can't load an image file by using relative filename.

Started by indigo0086, May 12, 2007, 05:25:44 PM

Previous topic - Next topic

indigo0086

Basically I have a GLFW project that loads an image file that is in the base directory (the one where the project is located) but in order for me to do It I can't just can't load it by the filename, I have to put the entire path to the filename.
Example.

rustWall.Load("RustyWall.tga");

does not work but

rustWall.Load("Z:\\Cpp\\OpenGL Examples\\GLFW Project\\RustyWall.tga");

does.

I have other example programs that use the base directory properly but this one does not.  It's been like this for several revisions of codeblocks nightly.



TDragon

Check your executable target's "Execution working dir" in your build target properties -- if you want it to be the same directory as the project file, just use ".". (Note: This only applies when running your program from within C::B.)
[url="https://jmeubank.github.io/tdm-gcc/"]https://jmeubank.github.io/tdm-gcc/[/url] - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

indigo0086

Ok I got it, now how do I set it to be that way default?

TDragon

Quote from: indigo0086 on May 12, 2007, 06:30:52 PM
Ok I got it, now how do I set it to be that way default?
I don't understand your question...
[url="https://jmeubank.github.io/tdm-gcc/"]https://jmeubank.github.io/tdm-gcc/[/url] - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

indigo0086

The GLFW projects don't have "." as the default "execution working dir".  How do I set it so that it is in future projects?

mandrav

Quote from: indigo0086 on May 12, 2007, 07:47:29 PM
The GLFW projects don't have "." as the default "execution working dir".  How do I set it so that it is in future projects?

That's a setting in the wizard. Next time you run the wizard, in the build targets page (debug/release), update the working dirs there and C::B will remember the from then on...
Be patient!
This bug will be fixed soon...

indigo0086

It only has "output directory" and "object output directory"