Skip to content

Commit

Permalink
Added comments and updated error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jmjaffe37 committed Apr 10, 2024
1 parent 26992fe commit 65dfd3f
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions wix/Build.OpenJDK_generic.cmd
Original file line number Diff line number Diff line change
@@ -232,6 +232,8 @@ FOR %%A IN (%ARCH%) DO (
GOTO FAILED
)

@REM Add suffix to declaration and references of the IcedTeaWebDir 'bin' subfolder
@REM This is to avoid dubplicate Id conflict with INSTALLDER 'bin' subfolder
powershell -ExecutionPolicy Bypass -File "%~dp0\helpers\Update-id.ps1" ^
-FilePath !ITW_WXS! ^
-Name bin ^
7 changes: 3 additions & 4 deletions wix/helpers/Update-id.ps1
Original file line number Diff line number Diff line change
@@ -44,23 +44,22 @@ if ($firstMatch -match $pattern) {
$directoryId = $matches[1]
}

# If the directory ID is found, update it
# If the directory ID is found, append the suffix to it's ID
if (-not $directoryId) {
Write-Host "Directory '$Name' not found in the file."
}
else {
Write-Host "Found Directory ID: $directoryId"
$updatedDirectoryId = $directoryId + $Suffix
Write-Host "updatedDirectoryId: $updatedDirectoryId"

# Replace declaration and references of the old ID with the updated ID
$IdRegex = $('Id="' + [regex]::Escape($directoryId) + '"')
$updatedContent = $fileContent | ForEach-Object {
if ($_ -match $IdRegex) {
# Replace Id declaration with the updated ID if IdRegex matches
$_ -replace $IdRegex, $('Id="' + [regex]::Escape($updatedDirectoryId) + '"')
}
else {
# Replace all instances of Directory="$FoundID" with Directory="$updatedDirectoryId"
# Replace all Directory ID references to the old ID with the updated ID
$_ -replace $('Directory="' + [regex]::Escape($directoryId) + '"'), $('Directory="' + [regex]::Escape($updatedDirectoryId) + '"')
}
}
2 changes: 1 addition & 1 deletion wix/helpers/Validate-Input.ps1
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ $inputArray = $toValidate -split "$delimiter"

for ($i = 0; $i -lt $inputArray.Length; $i++) {
if ($validInputArray -notcontains $inputArray[$i]) {
echo $inputArray[$i] ' is an invalid input'
Write-Output $inputArray[$i] ' is an invalid input'
exit 1 # Invalid input
}
}

0 comments on commit 65dfd3f

Please sign in to comment.