legacy-cli icon indicating copy to clipboard operation
legacy-cli copied to clipboard

Feature request: Support the XDG Base Directory Specification

Open pfrenssen opened this issue 2 years ago • 1 comments

Currently the configuration files, binary, cache files etc are placed in a hidden folder in the user's home directory: ~/.platformsh. This is not following the XDG standard which is used across all common operating systems (Linuxes, Unixes and most Windows shells).

It would be great if we could default to the right locations ($XDG_CONFIG_HOME for the configuration, $XDG_STATE_HOME for state.json, $XDG_CACHE_HOME for cache files etc).

To provide backwards compatibility, we could check if ~/.platformsh exists, and use it if it does, but new installations should follow the standard.

For a good overview of what the standard entails, see https://wiki.archlinux.org/title/XDG_Base_Directory

pfrenssen avatar Apr 21 '22 15:04 pfrenssen

I recognise it's nice to comply with specifications in general. But is there another practical advantage?

There's a support advantage when everyone has files in the same place regardless of configuration or OS. There's also somewhat an advantage of locating the binaries, cache, state, and config in the same place (easy to delete), although also this can be a disadvantage (not easy to use separate filesystems, e.g. r/o for bin and r/w for cache).

As well as backwards compatibility, I had particularly wanted to avoid the potential for installation resulting in multiple copies of the application in different locations. Tools such as Drush and PHP itself suffer from this (frequently PHP has been installed via MAMP and via Homebrew, at different versions and with different extensions enabled depending on the user / PATH).

Maybe this could be done carefully for the next major version alongside a reworking of how the app is packaged/installed.

pjcdawkins avatar May 05 '22 08:05 pjcdawkins

Maybe this could be done carefully for the next major version alongside a reworking of how the app is packaged/installed.

A lot of this has happened now since https://github.com/platformsh/cli and all packaging/installation decisions are happening there

pjcdawkins avatar Mar 25 '23 10:03 pjcdawkins