Code::Blocks Forums

User forums => Help => Topic started by: indigo0086 on May 12, 2007, 05:25:44 pm

Title: Can't load an image file by using relative filename.
Post by: indigo0086 on May 12, 2007, 05:25:44 pm
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.

Code
rustWall.Load("RustyWall.tga");

does not work but

Code
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.


Title: Re: Can't load an image file by using relative filename.
Post by: TDragon on May 12, 2007, 05:50:41 pm
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.)
Title: Re: Can't load an image file by using relative filename.
Post by: indigo0086 on May 12, 2007, 06:30:52 pm
Ok I got it, now how do I set it to be that way default?
Title: Re: Can't load an image file by using relative filename.
Post by: TDragon on May 12, 2007, 06:59:28 pm
Ok I got it, now how do I set it to be that way default?
I don't understand your question...
Title: Re: Can't load an image file by using relative filename.
Post by: 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?
Title: Re: Can't load an image file by using relative filename.
Post by: mandrav on May 12, 2007, 07:58:56 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...
Title: Re: Can't load an image file by using relative filename.
Post by: indigo0086 on May 12, 2007, 11:43:19 pm
It only has "output directory" and "object output directory"