Provide a way to configure an alternative user data directory for the application other than the default appdata location
The user data path used by Foundry VTT must be outside the Application directory. There are four ways that the user data location can be set.
- Command Line Flag
- Environment Variable
- Config Data Override
- Default Application Data Location
These options are evaluated in the above order, so if multiple options are set, the first valid option will be used.
Command Line Flag
The application now supports a command line flag --dataPath=<path>
which designates a custom user data directory.
Node.js
node main.js --world=worldName --dataPath=/local/data/foundryvtt
Electron (Windows)
FoundryVTT.exe --world=worldName --dataPath=D:/FoundryVTT
Electron (Linux)
foundryvtt --world=worldName --dataPath=/local/data/foundryvtt
Environment Variable
Instead of passing a custom path every time when starting the application you can set the FOUNDRY_VTT_DATA_PATH
environment
variable which will be used instead (if a command line flag is not passed).
Example (Linux)
export FOUNDRY_VTT_DATA_PATH=/local/data/foundryvtt
foundryvtt --world=worldName
Example (Windows)
setx FOUNDRY_VTT_DATA_PATH "%USERPROFILE%\aws\cert.pem"
FoundryVTT.exe --world=worldName
Config Data Override
A last option which is supported is to redirect the data location in the options.json
file inside the default application
data location. For example, setting the following would redirect the application to use an alternative user data path.
"dataPath": "D:/FoundryVTT"
Hotfix for 0.4.0 Testing
Use the attached file main.js
to replace the file with the same name in resources/app/main.js
. This new entry point for the application will allow each of the above options to be used to configure the user data path.
Test Cases
- Provided CLI argument
- Provided ENV variable
- Provided config options override
- Provided nothing
- CLI + other option - prefers CLI
- ENV + config - prefers ENV
- Target a directory where the parent path does not exist raises error
- Target the application installation directory fails