I am working on a resources loader for my personal C++/OpenGL ES engine. My resources are in a
resources folder separated trough different sub-folders (
I am currently giving a path to this folder when I want to load a file. My code looks like this:
The problem is - in addition to not be gracious - it depends of the current working directory and of the final binary location when I execute it.
How can I store the complete path to the resource when I call the
load function to be able to load it regardless of working directory? I would like to be able to use the following line:
Regardless of where I am compiling nor executing my game, as long as I told to the texture manager where is the resources folder.
I tried to find a solution using
__FILE__ macro, because I can get the complete path to the compiling file with it, but it would be the path to the source file, not the path to the binary.
I'm trying to make it cross-plateform, so I would prefer a solution not working through an external editor or IDE.