Skip to content

Add options to set the user/cache dirs#9724

Open
RossBrunton wants to merge 1 commit intoCard-Forge:masterfrom
RossBrunton:vars
Open

Add options to set the user/cache dirs#9724
RossBrunton wants to merge 1 commit intoCard-Forge:masterfrom
RossBrunton:vars

Conversation

@RossBrunton
Copy link

This adds two new environment variables, FORGE_USER_DIR and FORGE_CACHE_DIR for overriding the default locations for user data.

For example, forge can be ran using:

FORGE_USER_DIR="$HOME/.local/state/forge" FORGE_CACHE_DIR="/tmp/forge" forge

To use alternate directories.

There should be no change in behaviour when neither of these vars are set.

@tool4ever
Copy link
Contributor

hmn what's the point?
using the preferences file should already cover this a bit more easily

@RossBrunton
Copy link
Author

I'm perhaps blind, but I can't see any documentation about a preferences file nor do I see a preferences file in the published build.

There's preferences information in the user dir, but that means that the user dir can't be relocated.

@tool4ever
Copy link
Contributor

it's right above the point in the guide you've edited

@RossBrunton
Copy link
Author

Had another look at this and it does look like that file can change the user data dir. For some reason I thought that file actually lived in the user dir and only controlled where the card images where stored. Sorry about that.

However, the properties file does have a few limitations:

  • It has to be hardcoded in the forge package, so individual users can't change it unless they download their own copy of forge. If installed via a package manager, the installed package needs to be modified which is messy.
  • As far as I can tell, it doesn't support the expansion of $USER or ~ (Or, presumably, %APPDATA% on Windows), meaning that the username has to be hardcoded.

With these two issues, I still think it makes sense to allow the user to override the locations using environment variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants