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=" ) {
$JVMARGS += $line
}
}
+ } else {
+ echo "Could not find VMOPTIONS file '${VMOPTIONS}'"
}
$JVMARGS += "-Duserdefaultappdir=true"
$JVMARGS += "-Dnouserdefaultappdir=false"
}
# 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