Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: In what directory does Image::LoadFromFile() search by defau  (Read 2397 times)

0 Members and 1 Guest are viewing this topic.

Howitzer21

  • Newbie
  • *
  • Posts: 16
    • View Profile
In what directory does Image::LoadFromFile() search by defau
« on: February 10, 2012, 05:37:37 am »
Real simple question:  Let's say I've got my executable in C:\Users\username\program\bin\Debug.  Let's also say I've got the next bit of code:

Code: [Select]

space.LoadFromFile("space.png");


where space is an Image.  What directory would space.png have to be in for it load properly?  Thanks!

thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
In what directory does Image::LoadFromFile() search by defau
« Reply #1 on: February 10, 2012, 05:42:31 am »
It will load from the working directory, in the case of visual studio, this is the directory containing the visual studio project. When you open the exe through explorer the working directory will be the directory the exe is in.

Howitzer21

  • Newbie
  • *
  • Posts: 16
    • View Profile
In what directory does Image::LoadFromFile() search by defau
« Reply #2 on: February 10, 2012, 05:58:03 am »
I've got a copy of the file in <program>, bin, and Debug (see the path above).  I've checked on the name of the file, and it matches the string in the code exactly.  However it's still crashing for some reason.  The IDE by the way is Code::Blocks.

Howitzer21

  • Newbie
  • *
  • Posts: 16
    • View Profile
In what directory does Image::LoadFromFile() search by defau
« Reply #3 on: February 10, 2012, 06:23:27 am »
Something I probably should've posted on my last reply is that I've also tried feeding it the absolute path and filename, and it still doesn't work.  ...Which makes me start to think the path isn't the problem?

Howitzer21

  • Newbie
  • *
  • Posts: 16
    • View Profile
In what directory does Image::LoadFromFile() search by defau
« Reply #4 on: February 10, 2012, 06:37:40 am »
Uh, sorry guys.  Apparently the problem was way off in a completely unrelated part of my code.  I don't know how I didn't pick up on that pretty quickly; I guess I probably just changed something else at the same time as adding that LoadFromFile() function in, and then forgot that I had changed it.  Still I know how to use a debugger and everything, so it's kind of strange.  Sorry about that.  Thanks for the help!

 

anything