I am creating a C++ SDL game engine, and it is relevant to know the executable path since images and other resources are not stored within the executable - they are in a separated folder("res/").
Under Linux, I am using a shell script "rungame.sh" that cd's to the executable path and then runs the executable(using then "./" to reference the executable folder). However, I believe this is an "ugly" approach and I want it to be Windows-compatible.
Also, the current approach is not very good as it may change the meaning of some command line arguments.
I want a cross-platform(*NIX, Windows and Mac OS X, if possible) solution to get the current path of the executable. The game path/executable name may change.
What is the cleanest way to solve my problem (preferrably using std::string and as few platform-dependent APIs as possible)?