On Wednesday, 13 May 2020 at 14:39:13 UTC, Mike Parker wrote:

It's up to the caller to ensure the path is valid. For example, if the executable is run from a different directory, then "libs" will not be relative to the current working directory. `SDL_GetBasePath` can help there:

https://wiki.libsdl.org/SDL_GetBasePath?highlight=%28%5CbCategoryFilesystem%5Cb%29%7C%28CategoryEnum%29%7C%28CategoryStruct%29


Well, duh. I put the cart before the horse on that one. SDL2.dll is going to be in the same subdirectory since all the others depend on it and will fail to load if it isn't there (they don't load it dynamically, of course).

Working with args[0] or, since this is a Windows-only thing, calling the Win32 API directly (GetModuleFileName, IIRC) will get you there.

Reply via email to