Skip to content
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

feat: support XDG_CONFIG_HOME for receipts #171

Merged
merged 3 commits into from
Dec 19, 2024
Merged

Conversation

mistydemeo
Copy link
Contributor

refs axodotdev/cargo-dist#1355.

We'll need to make sure we ship the cargo-dist side as well when shipping this, so we don't get a mismatch in expectations.

An open question on this and the other PR: is it appropriate for us to respect this on both Linux and Mac? I'm assuming yes.

cc @brennanfee

Gankra
Gankra previously requested changes Sep 19, 2024
Copy link
Contributor

@Gankra Gankra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm this isn't quite right

  • if we see XDG_CONFIG_HOME in env we should always check it regardless of platform
  • we need to try to load a receipt from every valid location for the platform, using the first successful one

@mistydemeo mistydemeo force-pushed the respect_xdg_config_home branch 2 times, most recently from 4dbc6bb to a21ae0a Compare October 9, 2024 17:51
We now check multiple receipt paths, including XDG_CONFIG_HOME.
We load a receipt from the first path which contains a receipt file,
ensuring we're able to manage the absence of a receipt in that path
if that environment variable is set.
Copy link

@duckinator duckinator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

I was going to suggest a test, but thinking about it a bit more, I think any test would basically be writing the exact logic a second time — and "this if/else if/else statement executes as the language says it should" is pretty much the same as assert!(true) // make sure booleans work. 😅

@mistydemeo mistydemeo force-pushed the respect_xdg_config_home branch 7 times, most recently from b9726ce to 768bf0b Compare December 19, 2024 19:14
@mistydemeo mistydemeo force-pushed the respect_xdg_config_home branch from 768bf0b to 4de5474 Compare December 19, 2024 19:19
@mistydemeo
Copy link
Contributor Author

Ended up finding a real test I could write, so I've confirmed that this works as expected.

@mistydemeo mistydemeo merged commit 55460ff into main Dec 19, 2024
13 checks passed
@mistydemeo mistydemeo deleted the respect_xdg_config_home branch December 19, 2024 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants