volta-cli / volta

Volta: JS Toolchains as Code. ⚡
https://volta.sh
Other
11.22k stars 238 forks source link

Non-standard macOS folder locations #1383

Open probablykasper opened 2 years ago

probablykasper commented 2 years ago

Volta creates a folder in the user's home folder, which goes against OS guidelines. I'm not a huge fan of this because it essentially results in data being stored in random locations, and things like cache clogging up my backups.

I'd recommend at least storing cache in ~/Library/Caches. If it's undesirable to store to use the ~/Library/Application Support for the other stuff, I'd at least suggest following the XDG defaults of using folders like ~/.config.

charlespierce commented 2 years ago

Hi @probablykasper, do you happen to have a link to any specific OS guidelines about apps? By default, you're correct that we store in ~/.volta, however that can be changed fairly easily. The data directory is managed by the VOLTA_HOME environment variable, so it should be possible to update that in your shell startup script (e.g. .zshrc, .bash_profile, .bashrc). There should be two lines in there that reference Volta:

export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"

Updating the first of those lines to point somewhere else should allow Volta to work out of any other directory that you want to use.

probablykasper commented 2 years ago

Yes, there's the File System Basics article: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html#//apple_ref/doc/uid/TP40010672-CH2-SW1

And the macOS Library Directory Details article: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html

The data directory is managed by the VOLTA_HOME environment variable

Thanks for letting me know !! :D

jsejcksn commented 1 year ago

@probablykasper The title has a typo:

- Non-stadard macOS folder locations
+ Non-standard macOS folder locations
magical-heyrovsky commented 1 year ago

See also https://github.com/volta-cli/rfcs/issues/12

chriskrycho commented 1 year ago

It would be relatively straightforward to use directories (referenced on the RFC mentioned immediately above) in place of the ~/.volta directory, and I would personally be in support of that—it uses the correct-per-platform location automatically and is quite robust. The main thing to consider then would be that we would need to check both places unless/until we had gone through a process of deprecating the existing location and eventually removing support for it, and building a migration to move it if we found an existing location.

getawaywithrmdir commented 7 months ago

Maybe check out etcetera? Some tools that depend on etcetera specifically include fd, helix editor, tokei, navi, sqlx[-postgres], topgrade, vivid, and trippy. (I'm not affiliated with any of these projects.)

A ton of Mac users want the option to set their XDG variables to override the usual locations, and the directories maintainer(s) are dead-set against supporting that, despite how many people want it and how common it is in practice. A few tools I use that honor XDG variables on Mac include curl, git, fd, nvim, sqlite3, Homebrew, and spaceship-prompt...so you'd be in good company 😊.

It looks like etcetera is flexible enough to work with whichever strategy you ultimately decide on using their convenience functions, so even if you weren't sure about the XDG strategy for Mac yet, it would make it easier to flip the switch if you changed your minds...

baggiponte commented 1 month ago

+1 on the XDG compliance. It's always requested by macOS users everywhere - I come from Python and always find a lot feature requests about that. Most of binaries support those out of the box (tmux, neovim...).