Open tribad opened 6 years ago
Probably a good idea to have the linux bin search common path locations ./ , /usr/share/openparsec, ~/.openparsec/ that sort of thing like other games do if we want people to be able to make distro packages for thing
One thing it needs to do is write parsecrc.con to a user home dir. That file stores the user's prefs and is pretty bad if it can't write it out. A useful default would be good too
For a guaranteed writable path for settings, SDL_GetPrefPath seems like it'd be useful.
SDL_GetPrefPath() seems ok for the user-config directory.
The installation path is a usefull information to create an absolut path to config files or what ever is needed to access at runtime.
On a linux machine this could be found through the /proc/ proc-pid
/exe
The benefit of that approach would be that you find the executable even if the user created a link to the executable and used that for starting the application.
For linux builds it would be no problem to find the path to the place from where the parsec application has been started. Because this may be usefull for the server as well it would be part of the libparsec. Whether a new modul gets created or the function get incorporated into some existing modules is not clear at the moment
With the solution I would add some classes I developed a long time ago to handle filenames/directories and files in a in-between way more like parsec inventors did. They use the standard C-library functions and define some sort of encapsulation of these function.
Whether these functions are going to be used in the future is up to you.
Anyway. Looking up the location the executed binary is from is done via the /proc filesystem and very linux specific. But it will be the base for any location specific file access.