Newer
Older
dub_jkp / changelog / dpath.dd
DUB settings & packages directory placement overhauled

You can now configure where DUB places its downloaded packages and where the user configuration is stored through environment variables or through the dub configuration. You need to use an environment variable or the system-wide dub configuration to specify where the user configuration is stored.

By default DUB stores the packages on
- Windows: `%APPDATA%/dub/settings.json` + `%LOCALAPPDATA%/dub/packages/`
- Posix: `$HOME/.dub/{packages/,settings.json}`

now if the `DUB_HOME` environment variable is set it instead stores the packages (and other config) in
- `$DUB_HOME/{packages/,settings.json}`

alternatively if `DUB_HOME` isn't set, but `DPATH` is set, the following path is used:
- `$DPATH/dub/{packages/,settings.json}`

The `DPATH` environment variable is intended to be used by all D tooling related things doing user-space installation of things. It can be used to avoid cluttering the home folder.

Additionally to environment variables it is possible to configure the package placement path + settings.json path through DUB's settings.json file. To configure where the user-editable settings.json is placed you need to adjust the system-wide dub configuration.

In the settings.json you can set the following fields:

```json
{
    "dubHome": "/path/to/dub", // sets both package store and config location
}
```

Additionally, these config paths will have environment variables using the `$VARIABLE` syntax resolved.

The following list describes which path is going to be picked, from top to bottom, stopping whenever one is found:

- `$DUB_HOME` environment variable
- `$DPATH` environment variable
- system-wide settings.json: `"dubHome"` property (only for userSettings)
- most specific settings.json: `"dubHome"` property (only for localRepository)