Use XDG_CONFIG_HOME for .platformio directory
See original GitHub issueTemporary solution
You can override default location of .platformio
folder using core_dir configuration option.
It is also possible to override the .platformio
directory with the PLATFORMIO_CORE_DIR
environment variable.
Configuration
Operating system: macOS 10.14
PlatformIO Version (platformio --version
): 4.0.1b3
Description of problem
The ~/.platformio
directory contains important config data including the user’s custom boards. It’s currently one of many hidden directories in my home folder. For most Unix-based systems these directories conventionally go in $XDG_CONFIG_HOME
, which is usually ~/.local/share
. This makes things neater for the user.
On Windows and macOS the variables XDG_CONFIG_HOME
usually aren’t defined, so you can use C:\Users\x\AppData\Roaming
and ~/.local/share
respectively (i.e., ~/.local/share
does exist on macOS but isn’t usually defined as XDG_CONFIG_HOME
).
Steps to Reproduce
- Run
pio init
- Observe new
.platformio
directory in$HOME
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:5 (2 by maintainers)
I think that allowing the user to override PIO’s defaults is besides the point; that’s a whole lot of directories which a user is forced to remap. The goal of the XDG Base Directory Specification is to free the user from the burden of having to manually manage each piece of software as a unique snowflake directory tree dumped somewhere random in their $HOME directory.
For example, what subdirectories of
~/.platformio
are configuration which needs to be backed up and can be synced between development machines? What directories possibly contain credentials which should never be backed up? Which are runtime data which is necessary to have on hand? Which are cache directories and can safely be discarded if disk space is low? The XDG spec is a way to avoid the user having to figure out the answers to those questions for each piece of software we install. If PIO respected the preferences I’ve already expressed (and shouldn’t have to say differently for every program I install), I’d know that~/.config/platformio/*
is configuration that I should back up,~/.cache/platformio
is safe to delete and can be recreated as needed, etc.Please reconsider opening this issue. Complying with the XDG spec brings a lot of benefits and loses nothing. It’s trivial to remain backwards compatible to support existing installations.
See a temporary solution located in the top comment.