mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-13 03:09:10 +08:00
Merge pull request #177 from Jackbennett/7zip
Try to find 7-zip if it's installed before an error.
This commit is contained in:
commit
1b7e647b4b
@ -1,15 +1,20 @@
|
|||||||
function Ensure-Exists ($path) {
|
function Ensure-Exists ($path) {
|
||||||
if (-not (Test-Path $path)) {
|
if (-not (Test-Path $path)) {
|
||||||
Write-Error "Missing required $path file"
|
Write-Error "Missing required $path! Ensure it is installed"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
return $true > $null
|
||||||
}
|
}
|
||||||
|
|
||||||
function Ensure-Executable ($command) {
|
function Ensure-Executable ($command) {
|
||||||
try { Get-Command $command -ErrorAction Stop > $null }
|
try { Get-Command $command -ErrorAction Stop > $null }
|
||||||
catch {
|
catch {
|
||||||
Write-Error "Missing $command! Ensure it is installed and on in the PATH"
|
if( ($command -eq "7z") -and (Ensure-Exists "$env:programfiles\7-zip\7z.exe") ){
|
||||||
exit 1
|
set-alias -Name "7z" -Value "$env:programfiles\7-zip\7z.exe" -Scope script
|
||||||
|
} else {
|
||||||
|
Write-Error "Missing $command! Ensure it is installed and on in the PATH"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user