-
Notifications
You must be signed in to change notification settings - Fork 55
Move swiftly default home directory to ~/.swiftly for all platforms #257
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
Move swiftly default home directory to ~/.swiftly for all platforms #257
Conversation
@swift-ci test macOS |
If swiftly wants to support Windows at any point - this wouldn't work. We should be using |
For Linux, I'd also pretty strongly advocate against making this change, as it would mean swiftly no longer conforms to the XDG Base Directory specification, which is somewhat of a standard on Linux for these kinds of things. |
Thanks @compnerd I think that Windows is certainly going to be a bit different with respect to swiftly flows. That does sounds like a good place to install swiftly on that platform. |
@patrickfreed thank you. The precedent I'm going for here is SwiftPM. It installs a Having a smaller more concise path will make it much cleaner in people's PATH. There is still code in Swiftly that uses XDG_HOME on Linux as the default base for the |
XDG is more comprehensive. Many of the other Linux packages have started adopting XDG recommendations for configuration. IIRC, fish is a prime example of a non-UI application adhering to the XDG specification. In general, that is considered good behaviour for applications to adopt that as a successor to FHS. |
I also vastly prefer swiftly using |
Honestly I like the ~/.swiftly directory better. It makes it easier to uninstall by just doing |
The XDG specifications are supported by various tools, including command line tools, including but not limited to Some tools, like On macOS I usually prefer the normal macOS location be used if possible, but XDG would be fine too (in particular one could change the I try to push XDG where possible and even wrote an implementation of the specifications in Swift, as I am strongly against the multiple dot-files that hang around in the home directory (most of the time w/o proper permissions BTW). |
Cargo appears to have picked I think what's interesting is that despite the XDG, the most common shells in Linux distros (bash, zsh) aren't adding any of the XDG locations to the default PATH, which could accelerate adoption, I suspect. |
AFAICT, the issue to support XDG is usually backward compatibility, which is why I think doing the support for it now (before 1.0) would make the more sense. |
Backward compatibility can be really tough, so it doesn't surprise me that these tools don't necessarily default to XDG standards, but instead have opt-ins. Is there any sign of macOS/Windows adopting XDG / freedesktop.org, or is this still mostly just Linux/BSD world? Another concern here is consistency within the Swift ecosystem. That's why I was wondering if there are existing Swift projects, preferably ones in the swiftlang organization, that have adopted already. It would be really strange for swiftly to support XDG layouts, and not SwiftPM, for example. The user experience could be confusing and frustrating. Perhaps we can consider enabling XDG across all of swiftlang as a joint activity in some future release. |
No, Windows doesn't support XDG and is unlikely to do so I imagine. |
Also of note, vim just added support for the spec as well: vim/vim#14182
I think if we tie it to something like this, it's very unlikely the switch will happen even in the medium term future. Prior to 1.0 is the best time to make these kinds of choices, especially in this case because swiftly already conforms to the XDG spec (and a decent bit of effort / thought went into that conformance I might add).
They're different projects, so I don't think it's necessarily a huge surprise that they might have different configuration mechanisms, especially given that the target audience in question for the XDG spec conformance are Linux Swift developers, who are used to dealing with this kind of thing. If anything, I think this argument would be better directed towards getting SwiftPM to adopt the standard, rather than having swiftly drop its adoption of it.
On Ubuntu at least, # set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi Lastly, if something like |
Because of the potential for collisions with tools like clang, clang++, and others that are in the toolchain, and also to give ability for users to more easily swap out the path for swiftly to switch swiftly off, swiftly and the proxies were moved to The hope is to simplify, shorten these paths, and make them consistent across Unixes. I checked my Ubuntu 24.04 desktop and I see that cargo is doing the identical thing despite it being in a full XDG environment. Cargo installs its files in my
Something as long and established history as vim can make the choice to fix this just last year. The Swift ecosystem can do it too. |
In my opinion, I don't see shortening the length of the path that contains the binaries as a worthwhile tradeoff for breaking from the XDG spec, especially given that swiftly will update the users PATH for them and the reduction is only 10 characters or so. I also don't think consistency across Unixes is a necessarily a desirable goal, given they have different standards and expectations. I don't really have strong opinons if we decide to move the macOS one to
It is true that cargo doesn't conform, but it was also a quite unfortunate choice for them, in my opinion at least (note the thumbs up vs thumbs down on the issue for adding XDG spec conformance to cargo). The link @Frizlab discusses the history there and the various attempts to improve it, which could be useful to check out when weighing things here. It's also true that other installers like nvm don't conform either, but again that doesn't mean we have to take that path too. I think it's preferable to conform to the standards of the given platform rather than the family of other similar open source tools that are doing the non-standard thing.
Notably, it took them 7 years to do so, whereas we have the opportunity to get it right on day 1. |
Thanks everyone for the feedback on this topic. I'm closing this PR, but it's still here to record the discussion. |
Standardize on a single location where swiftly is located on both Linux and macOS.