mirror of
https://github.com/SK8-ENGINE/skate-3-rust-engine.git
synced 2026-10-26 19:47:44 +00:00
12 lines
659 B
PowerShell
12 lines
659 B
PowerShell
# Find the user's Rust installation even when this script is launched directly.
|
|
$ErrorActionPreference = 'Stop'
|
|
if ((Get-Command cargo -ErrorAction SilentlyContinue) -and (Get-Command rustc -ErrorAction SilentlyContinue)) { return }
|
|
$cargoRoot = if ($env:CARGO_HOME) { $env:CARGO_HOME } else { Join-Path $env:USERPROFILE '.cargo' }
|
|
$rustBin = Join-Path $cargoRoot 'bin'
|
|
if ((Test-Path -LiteralPath (Join-Path $rustBin 'cargo.exe')) -and
|
|
(Test-Path -LiteralPath (Join-Path $rustBin 'rustc.exe'))) {
|
|
$env:PATH = $rustBin + ';' + $env:PATH
|
|
return
|
|
}
|
|
throw 'Cargo and rustc were not found. Install Rust with rustup or add your Rust toolchain to PATH.'
|