Closed namandixit closed 1 day ago
What’s the use case for this? Can you show a pseudo-code example?
Let's say I want to maintain a list of recently opened files, but the software could be launched with any arbitrary current working directory and file can be provided by user with a relative path (app.exe data\file.txt
). I can't store relative paths in that situation.
Although I realized that another thing that might work is simply a function to get the absolute path to current working directory. Closing this for now unless you feel path conversion is something worth adding.
In the absence of
chdir
(https://github.com/libsdl-org/SDL/issues/9428), one way to simulate a similar effect is to prefix an absolute base path to the relative path to get the absolute path of a file/directory. To do this, it would be useful to be able to get the absolute path of any arbitrary file/directory given it's relative path, which the game might have gotten from anini
file or a command line argument. One place this would be useful in is for handling user-generated content — say, users providing custom path for installed mod.One way could have been to add the absolute path in
SDL_PathInfo
as returned bySDL_GetPathInfo
, but that will complicate memory management (in addition to changing the ABI). Therefore, the best way will probably be to simply add awhose result should be
SDL_free
d.