Add PATH check after binary install

This commit is contained in:
thePR0M3TH3AN
2025-06-19 19:01:57 -04:00
parent bd0895abb3
commit d557f6d59a
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) { if (Get-Command pipx -ErrorAction SilentlyContinue) {
try { try {
pipx install voxvera --force pipx install voxvera --force
@@ -61,6 +69,8 @@ if (Get-Command pipx -ErrorAction SilentlyContinue) {
if (-not (Download-Binary $url "$dest/voxvera.exe")) { if (-not (Download-Binary $url "$dest/voxvera.exe")) {
Write-Host 'Binary download failed, falling back to pip' Write-Host 'Binary download failed, falling back to pip'
Install-PipFallback Install-PipFallback
} else {
Check-LocalBin
} }
} }
} else { } else {
@@ -71,6 +81,8 @@ if (Get-Command pipx -ErrorAction SilentlyContinue) {
if (-not (Download-Binary $url "$dest/voxvera.exe")) { if (-not (Download-Binary $url "$dest/voxvera.exe")) {
Write-Host 'Binary download failed, falling back to pip' Write-Host 'Binary download failed, falling back to pip'
Install-PipFallback Install-PipFallback
} else {
Check-LocalBin
} }
} }

View File

@@ -75,6 +75,12 @@ download_binary() {
chmod +x "$dest" 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() { pip_fallback() {
if command_exists pip; then if command_exists pip; then
echo "Attempting pip install as fallback..." echo "Attempting pip install as fallback..."
@@ -99,6 +105,8 @@ if command_exists pipx; then
if ! download_binary "$url" "$dest"; then if ! download_binary "$url" "$dest"; then
echo "Binary download failed, falling back to pip." >&2 echo "Binary download failed, falling back to pip." >&2
pip_fallback pip_fallback
else
check_local_bin
fi fi
fi fi
else else
@@ -109,6 +117,8 @@ else
if ! download_binary "$url" "$dest"; then if ! download_binary "$url" "$dest"; then
echo "Binary download failed, falling back to pip." >&2 echo "Binary download failed, falling back to pip." >&2
pip_fallback pip_fallback
else
check_local_bin
fi fi
fi fi