Author Topic: Why does code::blocks want image under user directory?  (Read 4926 times)

Offline milleja46

  • Single posting newcomer
  • *
  • Posts: 4
Why does code::blocks want image under user directory?
« on: September 21, 2012, 02:28:28 pm »
Ok, I've just started using code::blocks, and wanted to test a friends lib he was making. The problem is I made a sdl project. After making it I tried running it to make sure sdl was working properly on my computer(since I was going to test the lib as a sdl lib). But it reported that it couldn't find the cb.bmp that it created for it. After some frustration, and asking on the irc channel, I figured out that it wanted it under /Users/mynamehere. Does anyone know why this might be and how to change it? I'm on mac by the way

Online Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Why does code::blocks want image under user directory?
« Reply #1 on: September 21, 2012, 02:47:01 pm »
It's up to the programmer to tell the app where to search for a file (text, image or whatever).

If you have used the wizard to create the sample sdl-app: it's just a simple skeleton, you have to fill it with really useful functions and make it work as you expect it, especially if you want to distribute your software.

Offline milleja46

  • Single posting newcomer
  • *
  • Posts: 4
Re: Why does code::blocks want image under user directory?
« Reply #2 on: September 21, 2012, 02:48:50 pm »
Yeah but why is it looking for the c::b generated cb.bmp under /Users/mynamehere ?

Online Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Why does code::blocks want image under user directory?
« Reply #3 on: September 21, 2012, 03:41:17 pm »
It's up to the programmer to tell the app where to search for a file (text, image or whatever).

And if you look at the code (and understand it), you know ehy this happens.

Just one hint: the default excution dir of the sample (if you run it through C::B) is the projects toplevel path (see "Project->Properties->Build targets").

Offline milleja46

  • Single posting newcomer
  • *
  • Posts: 4
Re: Why does code::blocks want image under user directory?
« Reply #4 on: September 21, 2012, 04:15:31 pm »
That doesn't seem to be true with the image since it seemed to expect it under my user directory instead...might it be a bug?

Online Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Why does code::blocks want image under user directory?
« Reply #5 on: September 21, 2012, 07:40:54 pm »
That doesn't seem to be true with the image since it seemed to expect it under my user directory instead...might it be a bug?
If it's the sample project, it expects the image in the directory you are in when starting the project.

Offline milleja46

  • Single posting newcomer
  • *
  • Posts: 4
Re: Why does code::blocks want image under user directory?
« Reply #6 on: September 21, 2012, 10:04:45 pm »
That makes no sense....

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Why does code::blocks want image under user directory?
« Reply #7 on: September 21, 2012, 10:12:25 pm »
You'll have to debug it to understand what is the real problem.

One way to do it is to use the call getcwd(...) and then to print the working path of the executable.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]