Author Topic: Can't load an image file by using relative filename.  (Read 5146 times)

Offline indigo0086

  • Almost regular
  • **
  • Posts: 150
Can't load an image file by using relative filename.
« 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.



Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Can't load an image file by using relative filename.
« Reply #1 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.)
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline indigo0086

  • Almost regular
  • **
  • Posts: 150
Re: Can't load an image file by using relative filename.
« Reply #2 on: May 12, 2007, 06:30:52 pm »
Ok I got it, now how do I set it to be that way default?

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Can't load an image file by using relative filename.
« Reply #3 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...
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline indigo0086

  • Almost regular
  • **
  • Posts: 150
Re: Can't load an image file by using relative filename.
« Reply #4 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?

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Can't load an image file by using relative filename.
« Reply #5 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...
Be patient!
This bug will be fixed soon...

Offline indigo0086

  • Almost regular
  • **
  • Posts: 150
Re: Can't load an image file by using relative filename.
« Reply #6 on: May 12, 2007, 11:43:19 pm »
It only has "output directory" and "object output directory"