I can't believe I'm still writing either!
I already wrote a function using GetModuleFileName. It is short. It does indeed work properly.
Now go here:
http://www.gapidraw.com/doc/204/doc-surface-main.htm#CreateSurface
It says:
GapiDraw will use the application path of your executable file and append the image file name (e.g. if your executable is "\Program Files\Games\MyGame\MyGame.exe" and you call CreateSurface with pImageFile set to "MyPicture.png", GapiDraw will try to load the image as "\Program Files\Games\MyGame\MyPicture.png").
That is wrong! When run from F5 in Visual Studio, GapiDraw will pick the directory one level up from the executable, while the GetModuleFileName method picks the correct directory.
I suspect that this is because GapiDraw uses another method, such as getting the current working directory, which yields different results under those circumstances.
So do you understand? GapiDraw has a bug in either its implementation or its documentation. I have already demonstrated a case where GapiDraw fails to perform as documented.
Try to understand, I'm not a newbie. I have been programming professionally for over seven years, from enterprise software to data mining to machine learning, on Mac/Unix/Windows/Palm/PocketPC, in C/C++/Java. I'm not an idiot, nor am I lazy.
So yes, I can write my own function, but that doesn't change the fact that there is a problem with GapiDraw (either implementation or documentation). Notwithstanding whether that function is ever exposed in the API. No amount of encouraging me not to be lazy is going to make this issue go away.
In the kind of software I am used to writing, it would be a serious issue if there were two functions to find a location for files. You can't have a server get half its files from one directory, and half from another, unexpectedly, under odd circumstances. If that happened, I would identify it as a problem to be fixed.
In this case, I am forced to write my own function, to use it to load my own files, and to also use it to create absolute paths for GapiDraw to load images, since I cannot rely on GapiDraw's functionality to find those files properly, as documented, under all circumstances.
Explain to me again why this isn't a problem?