question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use XDG_CONFIG_HOME for .platformio directory

See original GitHub issue

Temporary 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

  1. Run pio init
  2. Observe new .platformio directory in $HOME

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:8
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

13reactions
lhansoncommented, Oct 21, 2019

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.

0reactions
ivankravetscommented, Mar 31, 2022

See a temporary solution located in the top comment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

XDG Base Directory - ArchWiki
Application Legacy Path Supported Since ALSA ~/.asoundrc 577df36 · 1.2.3 Android Studio ~/.AndroidStudioX.X Android Studio 4.1 Anki ~/Anki , ~/Documents/Anki
Read more >
Where should the XDG_CONFIG_HOME variable be defined?
XDG Base Directory Specification clearly says: If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.
Read more >
macos - Equivalents of XDG_CONFIG_HOME and ...
Mapping XDG Base Directory Specification locations for "My App" on Mac OS X ... apply to using the best locations on the Mac...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found