Report Windows installer PATH status accurately
ci / test (push) Canceled after 0s
ci / fuzz-smoke (push) Canceled after 0s
ci / macos-client (macos-aarch64, macos-14) (push) Canceled after 0s
ci / macos-client (macos-x86_64, macos-13) (push) Canceled after 0s
ci / windows-client (push) Canceled after 0s
ci / package-release (linux-x86_64, ubuntu-latest, , , ) (push) Canceled after 0s
ci / package-release (macos-aarch64, macos-14, , , ) (push) Canceled after 0s
ci / package-release (macos-x86_64, macos-13, , , ) (push) Canceled after 0s
ci / package-release (windows-aarch64, windows-latest, aarch64, windows, aarch64-pc-windows-msvc) (push) Canceled after 0s
ci / package-release (windows-x86_64, windows-latest, , , ) (push) Canceled after 0s
ci / remote-bench (push) Canceled after 0s
ci / publish-gitea-release (push) Canceled after 0s
ci / test (push) Canceled after 0s
ci / fuzz-smoke (push) Canceled after 0s
ci / macos-client (macos-aarch64, macos-14) (push) Canceled after 0s
ci / macos-client (macos-x86_64, macos-13) (push) Canceled after 0s
ci / windows-client (push) Canceled after 0s
ci / package-release (linux-x86_64, ubuntu-latest, , , ) (push) Canceled after 0s
ci / package-release (macos-aarch64, macos-14, , , ) (push) Canceled after 0s
ci / package-release (macos-x86_64, macos-13, , , ) (push) Canceled after 0s
ci / package-release (windows-aarch64, windows-latest, aarch64, windows, aarch64-pc-windows-msvc) (push) Canceled after 0s
ci / package-release (windows-x86_64, windows-latest, , , ) (push) Canceled after 0s
ci / remote-bench (push) Canceled after 0s
ci / publish-gitea-release (push) Canceled after 0s
This commit is contained in:
+9
-1
@@ -458,6 +458,14 @@ function Write-Utf8NoBom($Path, $Content) {
|
|||||||
[System.IO.File]::WriteAllText($Path, $Content, $encoding)
|
[System.IO.File]::WriteAllText($Path, $Content, $encoding)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Write-PathStatus($PathToCheck) {
|
||||||
|
if (PathList-Contains $env:Path $PathToCheck) {
|
||||||
|
Write-Info "Current terminal PATH includes Dosh."
|
||||||
|
} else {
|
||||||
|
Write-Info "Open a new terminal if dosh is not found on PATH."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$bindir = Normalize-PathForCompare (Join-Path $Prefix "bin")
|
$bindir = Normalize-PathForCompare (Join-Path $Prefix "bin")
|
||||||
$configDir = Normalize-PathForCompare (Join-Path $HOME ".config\dosh")
|
$configDir = Normalize-PathForCompare (Join-Path $HOME ".config\dosh")
|
||||||
New-Item -ItemType Directory -Force -Path $bindir, $configDir | Out-Null
|
New-Item -ItemType Directory -Force -Path $bindir, $configDir | Out-Null
|
||||||
@@ -644,4 +652,4 @@ Write-Info "Client config:"
|
|||||||
Write-Info " $configDir\client.toml"
|
Write-Info " $configDir\client.toml"
|
||||||
Write-Info " $configDir\hosts.toml"
|
Write-Info " $configDir\hosts.toml"
|
||||||
Write-Info ""
|
Write-Info ""
|
||||||
Write-Info "Open a new terminal for PATH changes to apply."
|
Write-PathStatus $bindir
|
||||||
|
|||||||
@@ -377,6 +377,7 @@ fn windows_installer_adds_user_path_idempotently() {
|
|||||||
let ps1 = include_str!("../install.ps1");
|
let ps1 = include_str!("../install.ps1");
|
||||||
assert!(ps1.contains("function Add-UserPath($PathToAdd)"));
|
assert!(ps1.contains("function Add-UserPath($PathToAdd)"));
|
||||||
assert!(ps1.contains("function PathList-Contains($PathValue, $PathToFind)"));
|
assert!(ps1.contains("function PathList-Contains($PathValue, $PathToFind)"));
|
||||||
|
assert!(ps1.contains("function Write-PathStatus($PathToCheck)"));
|
||||||
assert!(ps1.contains("$bindir = Normalize-PathForCompare (Join-Path $Prefix \"bin\")"));
|
assert!(ps1.contains("$bindir = Normalize-PathForCompare (Join-Path $Prefix \"bin\")"));
|
||||||
assert!(ps1.contains("if ($env:DOSH_INSTALL_BINDIR_FILE)"));
|
assert!(ps1.contains("if ($env:DOSH_INSTALL_BINDIR_FILE)"));
|
||||||
assert!(ps1.contains("Write-Utf8NoBom $env:DOSH_INSTALL_BINDIR_FILE $bindir"));
|
assert!(ps1.contains("Write-Utf8NoBom $env:DOSH_INSTALL_BINDIR_FILE $bindir"));
|
||||||
@@ -397,6 +398,13 @@ fn windows_installer_adds_user_path_idempotently() {
|
|||||||
"Windows installer must not write a leading semicolon when user PATH is empty"
|
"Windows installer must not write a leading semicolon when user PATH is empty"
|
||||||
);
|
);
|
||||||
assert!(ps1.contains("Add-UserPath $bindir"));
|
assert!(ps1.contains("Add-UserPath $bindir"));
|
||||||
|
assert!(ps1.contains("Write-PathStatus $bindir"));
|
||||||
|
assert!(ps1.contains("Current terminal PATH includes Dosh."));
|
||||||
|
assert!(ps1.contains("Open a new terminal if dosh is not found on PATH."));
|
||||||
|
assert!(
|
||||||
|
!ps1.contains("Open a new terminal for PATH changes to apply."),
|
||||||
|
"Windows installer should not always claim a new terminal is required"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Reference in New Issue
Block a user