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

Use $Env:CARGO_HOME in ps1 install script #1509

Merged
merged 1 commit into from
Nov 20, 2023
Merged

Conversation

CAD97
Copy link
Contributor

@CAD97 CAD97 commented Nov 20, 2023

I have $env:CARGO_HOME set and just had this warning tell me I was missing the wrong path from my path. This makes the ps1 script do the same thing as the sh script and look in $env:CARGO_HOME if present.

I originally used ?? to null coalesce, but switched to just an if expression since ?? was only added in pwsh 7 (PowerShell Core, the cross platform one you need to install), thus isn't available in Windows Powershell. The if works in Windows PowerShell as well.

@CAD97
Copy link
Contributor Author

CAD97 commented Nov 20, 2023

PS C:\Users\CAD> $cargo_home = if ($Env:CARGO_HOME -ne $null) { $Env:CARGO_HOME } else { "$HOME\.cargo" }
PS C:\Users\CAD> $Env:Path -split ";" -notcontains "$cargo_home\bin"
False
PS C:\Users\CAD> $Env:Path -split ";" -notcontains "$HOME\.cargo\bin"
True

@NobodyXu NobodyXu enabled auto-merge November 20, 2023 07:12
@NobodyXu
Copy link
Member

Thank you!

@NobodyXu NobodyXu added this pull request to the merge queue Nov 20, 2023
Merged via the queue into cargo-bins:main with commit 469fc17 Nov 20, 2023
35 checks passed
@CAD97 CAD97 deleted the patch-1 branch November 20, 2023 10:19
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