I am attempting to load some images into a very basic C++/SDL based program. The images are loaded using SDL_LoadBMP
. I have the image loading and everything seems to work perfectly. My problem is that the image is loaded relative to where I call the program from.
So I have a directory structure that goes something like this.
project/
src/
source.cpp
assets/
image.bmp
bin/
program
When I execute the program from the project directory (./bin/program
) it has to use a path of assets/image.bmp
to load the image. Is there any way I can use a relative path of ../assets/image.bmp
so the program can be executed from anywhere?
I think I need something that provides the absolute path to the program that I can then append my paths to.