-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
utilize the user configuration directory for configs and savefiles #307
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LUS probably shouldn't be the one doing this searching of directories to begin with, instead of this, LUS should probably just be handed file paths and not be doing any logic, and the implementing application should probably be responsible for searching these directories.
Also, the SHIP_BIN_DIR env variable is specific to Ship of Harkinian. Other games would probably want to use a different env variable. I realize that one was already in the codebase, it probably shouldn't have been.
Part of me feels like it might be a decent idea for LUS to still expose a function like LocateFileAcrossAppDirs
for games to use if they want, but another part of me feels like other libraries for searching the common config/data/xdg folders for these files already exists and should be used by the end-user applications if they want that functionality.
I would want to make sure we test the use case of having multiple versions of ship with different settings. It seems this logic would always load from the user config dir instead of For example, if I were to have a release build set up and ready to play, then I download a PR build to test, I wouldn't want that PR build to touch my release build's settings |
Here's my own suggestions:
I've always wanted to put this patch in the codebase as this idea was implemented and engraved to the Arch AUR package i mentioned since the package's creation, using patches that adds slight features that can make program's functionality of what an installed package should do. For portability concerns this is a kind of a problem to users who wanted the program to make it portable. But for some users who are willing to install the program like installing a package this is the way I would do. I don't wanna always update the patch in the unofficial package on failed builds because of new code changes. |
maybe a CLI argument for |
07a7093
to
acf4c9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy
found issue(s) with the introduced code (1/1)
No clang-tidy warnings found so I assume my comments were addressed
Seems like the Shipwrigth repo needs an update to build with those changes. |
This change is based from the patch in this unofficial AUR package and has been implemented for quite some time now, so the goal of it is to address or introduce some issues or ideas related to installation paths on Linux systems or anything path related.
Some of the few key changes are:
Context::GetAppDirectoryPath
function now returns the location of the user's application data directory usingSDL_GetPrefPath
. This means any game configurations or save files will be stored and read from that directory. This can be overridden by theSHIP_HOME
environment variable. By default, this function returns~/.local/share/soh
on Linux or%APPDATA%\soh
on Windows.Context::GetAppBundlePath
(replaced withContext::GetAppInstallationPath
) function now hardcodes the installation path utilizingCMAKE_INSTALL_PREFIX
instead of theSHIP_BIN_DIR
environment variable, by activatingNON_PORTABLE
in the configure flags. (In the aforementioned AUR package the installation prefix is set to/opt/soh
).Also, I've removed the SHIP_BIN_DIR env var as said and done it's only exclusive to Ship.Update: When on Linux and is portable, it now gives the program's path instead, thus SHIP_BIN_DIR is not needed.Context::LocateFileAcrossAppDirs
to search for a given file in the above paths. If the file is not found, it prepends./
to the file path without checking.Note that this modifies where application data (typically configuration and save files) is stored.Update: I've added the configure option-DNON_PORTABLE=ON
to seperate portability and system-installed Now these files are located in the OS-specific directories mentioned above instead of the current directory where the program is running. When the game launches unless you did move them, it will reset to the original state. Let me know what are other problems arise from this. Additionally you can check for any other potential issues that I haven't looked upon.