Get path of executable

前端 未结 23 1574
清歌不尽
清歌不尽 2020-11-22 07:04

I know this question has been asked before but I still haven\'t seen a satisfactory answer, or a definitive \"no, this cannot be done\", so I\'ll ask again!

All I wa

23条回答
  •  一生所求
    2020-11-22 07:33

    SDL2 (https://www.libsdl.org/) library has two functions implemented across a wide spectrum of platforms:

    • SDL_GetBasePath
    • SDL_GetPrefPath

    So if you don't want to reinvent the wheel... sadly, it means including the entire library, although it's got a quite permissive license and one could also just copy the code. Besides, it provides a lot of other cross-platform functionality.

提交回复
热议问题