Skip to content

Commit

Permalink
feat: support XDG_CONFIG_HOME
Browse files Browse the repository at this point in the history
Co-authored-by: Brennan Fee <brennan.git@mailbots.org>
  • Loading branch information
mistydemeo and brennanfee committed Dec 19, 2024
1 parent 7872825 commit 3f44685
Show file tree
Hide file tree
Showing 50 changed files with 255 additions and 89 deletions.
6 changes: 5 additions & 1 deletion cargo-dist/templates/installer/installer.ps1.j2
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ if ($env:INSTALLER_DOWNLOAD_URL) {
$receipt = @"
{{ receipt | tojson }}
"@
$receipt_home = "${env:LOCALAPPDATA}\{{ app_name }}"
if ($env:XDG_CONFIG_HOME) {
$receipt_home = "${env:XDG_CONFIG_HOME}\{{ app_name }}"
} else {
$receipt_home = "${env:LOCALAPPDATA}\{{ app_name }}"
}

if ($env:{{ env_vars.disable_update_env_var }}) {
$install_updater = $false
Expand Down
2 changes: 1 addition & 1 deletion cargo-dist/templates/installer/installer.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fi
read -r RECEIPT <<EORECEIPT
{{ receipt | tojson }}
EORECEIPT
RECEIPT_HOME="${HOME}/.config/{{ app_name }}"
RECEIPT_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/{{ app_name }}"
usage() {
# print help (this cat/EOF stuff is a "heredoc" string)
Expand Down
1 change: 1 addition & 0 deletions cargo-dist/tests/gallery/dist/powershell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ impl AppResult {
.env("LOCALAPPDATA", &appdata)
.env("MY_ENV_VAR", &app_home)
.env_remove("CARGO_HOME")
.env_remove("XDG_CONFIG_HOME")
.env_remove("PSModulePath")
})?;
eprintln!(
Expand Down
1 change: 1 addition & 0 deletions cargo-dist/tests/gallery/dist/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ impl AppResult {
.env("ZDOTDIR", &tempdir)
.env("MY_ENV_VAR", &app_home)
.env_remove("CARGO_HOME")
.env_remove("XDG_CONFIG_HOME")
})?;
// we could theoretically look at the above output and parse out the `source` line...

Expand Down
8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/akaikatana_basic.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cargo-dist/tests/snapshots/akaikatana_musl.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/akaikatana_two_bin_aliases.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/akaikatana_updaters.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/axolotlsay_abyss.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/axolotlsay_abyss_only.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/axolotlsay_alias.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/axolotlsay_basic.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3f44685

Please sign in to comment.