Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Create 0000_cargo_standard_directories.md #1
base: master
Are you sure you want to change the base?
Create 0000_cargo_standard_directories.md #1
Changes from all commits
d0a37a8
178f08a
daf8b52
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
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.
That sounds like a good choice, simply linking to the spec/API on all three platforms.
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.
That also sounds good to me. We can update to include the
$XDG_BIN_DIR
when or if the XDG spec changes to include it.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.
Technically, those aren't the default values of
$XDG_CONFIG_HOME
,$XDG_CACHE_HOME
or$XDG_BIN_HOME
. Perhaps it would be clearer to say something like:EDIT: I forgot suggestions were a thing, sorry!
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.
Actually, the most official-looking copy of the XDG Basedir spec I can find does not mention
$XDG_BIN_HOME
, it just hard-codes$HOME/.local/bin
.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.
@Screwtapello
I can definitively confirm that this is the current state of affairs with XDG -- there is no $XDG_BIN_HOME, they decided to go with just specifying the location in the XDG Basedir Spec alone. I argued against this throughout the whole discussion, but I didn't have a decisive use-case. That was before the following:
From Issue 1615
If I'm correct, that's a definitive need for the 1$XDG_BIN_HOME variable. Can anyone else argue otherwise? ..because the XDG people will, and I'd like to be able to shoot those arguments down.
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.
I'm not sure I understand that – XDG's dir for executables is specified to be a sibling
subdir ofXDG_DATA_HOME
, so if some things aren't writable, the binary dir not being writable will be the least of your concerns.This comment was marked as outdated.
Sorry, something went wrong.
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.
One alternative to an
$XDG_BIN_HOME
variable might be "the first writable entry on$PATH
". Then application sandboxes like Flatpak could stick a sandboxed directory at the front of$PATH
and be done.A counter-counter-argument to that counter-argument might be that the same duality already exists between, say
$XDG_CONFIG_HOME
and$XDG_CONFIG_DIRS
:$XDG_CONFIG_DIRS
$PATH
$XDG_CONFIG_HOME
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.
In the context of this RFC, let's just follow the spec as is and move the discussion about the spec itself to the XDG issue tracker or elsewhere.
For the purposes of cargo, the bin dir would be separately overridable using $CARGO_BIN_DIR anyway
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.
Alternatively, you could use a library that deals with this.
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.
@soc The spec hardcodes the bin dir as
$HOME/.local/bin
not$XDG_DATA_HOME/bin
(which would be~/.local/share/bin
).Even if the bin dir was somehow "derived" from the value of
$XDG_DATA_HOME
, it could lead to unexpected situations where a write is attempted in the parent dir of$XDG_DATA_HOME
Ie: Attempting to create
bin/
in/unwritabledir/
if$XDG_DATA_HOME
points to/unwritabledir/userdata/
.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.
@0x5c yeah, saw it, not sure if that was intentional or not. Not sure this is relevant for this PR anymore, as the directory haggling predictably derailed any other work on this PR.
Interestingly they also finally managed to standardize
XDG_STATE_HOME
after like 10 years ... I will update my libraries to support that.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.
Because
%LOCALAPPDATA%
gets mentioned times and times again:Unlike on Linux, Windows doesn't care about the value of
%LOCALAPPDATA%
, so pretending its value has any kind of meaning on that platform is wrong and broken.SHGetKnownFolderPath
is the sole source of truth.(Libraries sorted this out already.)