From 402d97c2a5acf19836a944e0eb1d1eca090c24d0 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Fri, 2 Aug 2024 16:06:22 +0100 Subject: [PATCH] JAL-3631 update.sh script fixed to work in Windows (11) --- utils/getdown/bin/update.ps1 | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/utils/getdown/bin/update.ps1 b/utils/getdown/bin/update.ps1 index d01747a..22b7405 100644 --- a/utils/getdown/bin/update.ps1 +++ b/utils/getdown/bin/update.ps1 @@ -129,11 +129,12 @@ if ( Test-Path -Path $GETDOWNCOREJAR ) { if ( $userspace ) { if ( Test-Path -Path $VMOPTIONS ) { $LINENUM = 0 - foreach ( $line in Get-Content $VMOPTIONS ) { + $lines = Get-Content -Path $VMOPTIONS + foreach ( $line in $lines ) { # remove comments - $line -Replace "#.*", "" + $line -Replace "#.*", "" | Out-Null # remove leading and trailing whitespace - $line -Replace "(^\s+|\s+$)", "" + $line -Replace "(^\s+|\s+$)", "" | Out-Null $LINENUM++ if ( $line -Match "^-Dsetuserappdirpath=" ) { @@ -147,6 +148,8 @@ if ( $userspace ) { $JVMARGS += $line } } + } else { + echo "Could not find VMOPTIONS file '${VMOPTIONS}'" } $JVMARGS += "-Duserdefaultappdir=true" $JVMARGS += "-Dnouserdefaultappdir=false" @@ -186,23 +189,19 @@ if ( -not ( Test-Path -Path $JAVA ) ) { } # we should always have at least one JVMARGS and GDL_ARGS so this is okay -$myJvmArgsString = '"' + $($JVMARGS -join '" "') + '"' -$myGdlArgsString = '"' + $($GDL_ARGS -join '" "') + '"' +$myJvmArgsString = '`"' + $($JVMARGS -join '`" `"') + '`"' +$myGdlArgsString = '`"' + $($GDL_ARGS -join '`" `"') + '`"' # quote the args and the command (in case of spaces) with escape chars (`) and precede with & to indicate a command not string $COMMAND = "& `"${JAVA}`" ${myJvmArgsString} -cp `"${GDL_CLASSPATH}`" com.threerings.getdown.launcher.GetdownApp ${myGdlArgsString}" - if ( $debug ) { - Write-Error -Message "Shell running: ${COMMAND}" + Write-Output "Shell running: ${COMMAND}" } - -Invoke-Expression -Command ${COMMAND} +Invoke-Expression -Command $COMMAND # move updated getdown-launcher.jar into place $COMMAND = "& `"${JAVA}`" ${myJvmArgsString} -cp `"${GDC_CLASSPATH}`" jalview.bin.GetdownLauncherUpdate" - if ( $debug ) { - Write-Error -Message "Shell running: ${COMMAND}" + Write-Output "Shell running: ${COMMAND}" } - -Invoke-Expression -Command ${COMMAND} +Invoke-Expression -Command $COMMAND -- 1.7.10.2