diff --git a/setupApps.ps1 b/setupApps.ps1 index 0bfb47d..e7409e3 100644 --- a/setupApps.ps1 +++ b/setupApps.ps1 @@ -68,26 +68,31 @@ function InstallZip { [string] $exe, [string] $app, [bool] $createSubfolder = $false + [string] $skipIf ) - $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 + if (-not (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 } - $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." } - 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 { @@ -141,7 +146,7 @@ function InstallApps { InstallExe -app "Couvac.exe" InstallZipMsi -zip "ChemSketch.zip" -msi "script.msi" InstallZipMsi -zip "Anagene.zip" -msi "Anagene.msi" - InstallZip -zip "EduPython.zip" -exe "EduPython.exe" -app "EduPython" + InstallZip -zip "EduPython.zip" -exe "EduPython.exe" -app "EduPython" -skipIf "C:\Program Files\EduPython" InstallZip -zip "rastop.zip" -exe "RasTop.exe" -app "RasTop" InstallExe -app "SalsaJ_2_3.exe" }