4 # parent dir of this script (should be the getdown app dir)
5 $DIR = Split-Path $MyInvocation.MyCommand.Path -Parent
7 # insert an "-open" parameter to Jalview's ARGS if ARG1 is non-zero-length, and not "open" or starts with a "-"
8 if ( $ARG1.length -gt 0 -and (-not $ARG1.StartsWith("-")) -and $ARG1 -ne "open" ) {
9 $ARGS = "-open " + $ARGS
13 $JAVA = "${APPDIR}/jre/bin/java.exe"
14 $GETDOWNTXT = "${APPDIR}/getdown.txt"
16 if (-not (Test-Path -Path "${GETDOWNTXT}")) {
17 throw "Cannot find getdown.txt"
20 if (-not (Test-Path -Path "${JAVA}")) {
21 Write-Host "Cannot find bundled java.exe. Using system and hoping for the best!"
25 $CLASSPATH = (Select-String -Path "${GETDOWNTXT}" -AllMatches -Pattern "code\s*=\s*(.*)$" | foreach { "$DIR/$($_.Matches.Groups[1].Value)" }) -join ":"
27 Invoke-Expression -Command "${JAVA} -cp ${CLASSPATH} jalview.bin.Launcher $ARGS"