-
Notifications
You must be signed in to change notification settings - Fork 45
Follow XDG base directory specification for swiftly's home and bin directories on Linux #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I just pushed up a commit that prompts the user for confirmation before deleting any non-swiftly managed executables, now that we're using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Only question is do you have any concerns with name clashes between all the swift tools and any other tool that might be installed in ~/.local/bin
. For instance this could overwrite another copy of clang.
Yeah, I actually learned that the hard way by testing this on my local machine lol. The commit I pushed up yesterday makes sure swiftly prompts the user about each file being overwritten before doing so, example here:
If the user says "n", then the toolchain won't be used / symlinks in As a side note, I found a bug in the symlink verification logic, which I've now fixed. |
@adam-fowler Does the user prompt approach seem good to you / any other comments? |
The prompt approach will do. |
…rectories on Linux (#26)
Closes #13
swiftly will now use
$SWIFTLY_HOME_DIR
if specified as its home directory. If that's unset, it will then try$XDG_DATA_HOME/swiftly
. If that is also unset, it will default to using$HOME/.local/share/swiftly
, as suggested by the XDG base directory spec.Another change is that swiftly will put its symlinks to the active toolchain in
$SWIFTLY_BIN_DIR
or, if that's unset,~/.local/bin
, as is also suggested by the XDG base directory spec. This also matches the behavior ofpip install --user
. A huge benefit of this is that by default the user won't need to modify their$PATH
at all to pick up swiftly-installed binaries, since~/.local/bin
is automatically included in most distributions PATH by default (including Ubuntu).The two environment variables will allow users to configure where these go in case they don't want to use the defaults.
Spec: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
Related rustup issue: rust-lang/rustup#247
This PR also fixes a bug where the symlinks for the last remaining toolchain were not cleaned up after it was uninstalled.