Skip to content

Commit

Permalink
fix(installer): improve existing installation detection/handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tigattack authored Aug 20, 2023
1 parent 580c621 commit 5b1aad2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,17 @@ Write-Output @'
'@

# Check if this project is already installed and if so, exit
if (Test-Path "$InstallParentPath\$project") {
if (Test-Path "$InstallParentPath\$project\resources\version.txt") {
$installedVersion = (Get-Content -Raw "$InstallParentPath\$project\resources\version.txt").Trim()
Write-Output "`n$project ($installedVersion) is already installed. This script cannot update an existing installation."
Write-Output "Please manually update or delete/rename the existing installation and retry.`n`n"
exit
exit 1
}
elseif ((Test-Path "$InstallParentPath\$project") -and (Get-ChildItem "$InstallParentPath\$project").Count -gt 0) {
"`nThe install path ($InstallParentPath\$project) already exists with children, " `
+ "but an existing installation couldn't be detected (looking for $InstallParentPath\$project\resources\version.txt)." | Write-Output
Write-Output "Please remove the install path and retry.`n`n"
exit 1
}

If ($Version -and $Version -notmatch '^v(\d+\.)?(\d+\.)?(\*|\d+)$') {
Expand Down

0 comments on commit 5b1aad2

Please sign in to comment.