Fixed2
This commit is contained in:
@@ -70,29 +70,30 @@ function InstallZip {
|
|||||||
[bool] $createSubfolder = $false,
|
[bool] $createSubfolder = $false,
|
||||||
[string] $skipIf = $false
|
[string] $skipIf = $false
|
||||||
)
|
)
|
||||||
if (-not (Test-Path -Path $skipIf -PathType Container) -and $skipIf -ne $false) {
|
if ($skipIf -ne $false -and (Test-Path -Path $skipIf -PathType Container)) {
|
||||||
$zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip)
|
|
||||||
Write-Host "Installing $zipName..."
|
|
||||||
$targetPath = $env:ProgramFiles
|
|
||||||
if ($createSubfolder) {
|
|
||||||
$subFolder = Join-Path $env:ProgramFiles $zipName
|
|
||||||
if (-not (Test-Path -Path $subFolder -PathType Container)) {
|
|
||||||
New-Item -Path $subFolder -ItemType Directory
|
|
||||||
}
|
|
||||||
$targetPath = $subFolder
|
|
||||||
}
|
|
||||||
if (Test-Path -Path (Join-Path $targetPath $app) -PathType Container) {
|
|
||||||
Remove-Item -Path (Join-Path $targetPath $app) -Recurse -Force
|
|
||||||
}
|
|
||||||
Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath $targetPath -Force
|
|
||||||
if (-not $zipName.Equals($app) -and (-not (Test-Path -Path (Join-Path $targetPath $app) -PathType Container))) {
|
|
||||||
Start-Sleep -s 2
|
|
||||||
Move-Item -Path (Join-Path $env:ProgramFiles $zipName) -Destination (Join-Path $env:ProgramFiles $app)
|
|
||||||
}
|
|
||||||
CreateShortcut -exe $(Join-Path -Path $env:ProgramFiles -ChildPath (Join-Path -Path $app -ChildPath $exe)) -app $app
|
|
||||||
} else {
|
|
||||||
Write-Host "$app already installed."
|
Write-Host "$app already installed."
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip)
|
||||||
|
Write-Host "Installing $zipName..."
|
||||||
|
$targetPath = $env:ProgramFiles
|
||||||
|
if ($createSubfolder) {
|
||||||
|
$subFolder = Join-Path $env:ProgramFiles $zipName
|
||||||
|
if (-not (Test-Path -Path $subFolder -PathType Container)) {
|
||||||
|
New-Item -Path $subFolder -ItemType Directory
|
||||||
|
}
|
||||||
|
$targetPath = $subFolder
|
||||||
|
}
|
||||||
|
if (Test-Path -Path (Join-Path $targetPath $app) -PathType Container) {
|
||||||
|
Remove-Item -Path (Join-Path $targetPath $app) -Recurse -Force
|
||||||
|
}
|
||||||
|
Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath $targetPath -Force
|
||||||
|
if (-not $zipName.Equals($app) -and (-not (Test-Path -Path (Join-Path $targetPath $app) -PathType Container))) {
|
||||||
|
Start-Sleep -s 2
|
||||||
|
Move-Item -Path (Join-Path $env:ProgramFiles $zipName) -Destination (Join-Path $env:ProgramFiles $app)
|
||||||
|
}
|
||||||
|
CreateShortcut -exe $(Join-Path -Path $env:ProgramFiles -ChildPath (Join-Path -Path $app -ChildPath $exe)) -app $app
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function CreateShortcut {
|
function CreateShortcut {
|
||||||
|
|||||||
Reference in New Issue
Block a user