Merge pull request #49 from PR0M3TH3AN/codex/check-if-home/local/bin-is-in-path

Check PATH in install scripts
This commit is contained in:
thePR0M3TH3AN
2025-06-19 19:03:08 -04:00
committed by GitHub
2 changed files with 22 additions and 0 deletions

View File

@@ -49,6 +49,14 @@ function Download-Binary {
}
}
function Check-LocalBin {
$home = [Environment]::GetFolderPath('UserProfile')
$binPath = Join-Path $home '.local\bin'
if (-not ($Env:PATH.Split(';') -contains $binPath)) {
Write-Host "Add $binPath to your PATH to run VoxVera."
}
}
if (Get-Command pipx -ErrorAction SilentlyContinue) {
try {
pipx install voxvera --force
@@ -61,6 +69,8 @@ if (Get-Command pipx -ErrorAction SilentlyContinue) {
if (-not (Download-Binary $url "$dest/voxvera.exe")) {
Write-Host 'Binary download failed, falling back to pip'
Install-PipFallback
} else {
Check-LocalBin
}
}
} else {
@@ -71,6 +81,8 @@ if (Get-Command pipx -ErrorAction SilentlyContinue) {
if (-not (Download-Binary $url "$dest/voxvera.exe")) {
Write-Host 'Binary download failed, falling back to pip'
Install-PipFallback
} else {
Check-LocalBin
}
}

View File

@@ -75,6 +75,12 @@ download_binary() {
chmod +x "$dest"
}
check_local_bin() {
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
echo "Add \$HOME/.local/bin to your PATH to run VoxVera."
fi
}
pip_fallback() {
if command_exists pip; then
echo "Attempting pip install as fallback..."
@@ -99,6 +105,8 @@ if command_exists pipx; then
if ! download_binary "$url" "$dest"; then
echo "Binary download failed, falling back to pip." >&2
pip_fallback
else
check_local_bin
fi
fi
else
@@ -109,6 +117,8 @@ else
if ! download_binary "$url" "$dest"; then
echo "Binary download failed, falling back to pip." >&2
pip_fallback
else
check_local_bin
fi
fi