# parent dir of this script (should be the getdown app dir). Follow symlinks.
$TARGET = ( Get-Item $MyInvocation.MyCommand.Path ).Target
-$DIR = If ( $TARGET -eq $null -or $TARGET.LinkType -ne "SymbolicLink" ) { Split-Path $MyInvocation.MyCommand.Path -Parent } Else { Split-Path $TARGET -Parent }
+$DIR = If ( $TARGET -eq $null -or $TARGET.LinkType -ne "SymbolicLink" ) { Split-Path -Path $MyInvocation.MyCommand.Path -Parent } Else { Split-Path -Path $TARGET -Parent }
# set the "-open" parameter if myArg1 is non-zero-length, and not "open" or starts with a "-"
$OPEN = ""
$OPEN = "-open"
}
-$APPDIR = $DIR
+$APPDIR = If ( ( Split-Path -Path $DIR -Leaf ) -eq "bin" ) { Split-Path -Path $DIR -Parent } Else { $DIR }
$JAVAEXE = If ( $myIsWindows ) { "java.exe" } Else { "java" }
$JAVA = Join-Path -Path $APPDIR -ChildPath ( "jre/" + $( If ( $myIsMacOS ) { "Contents/Home/" } Else { "" } ) + "bin/${JAVAEXE}" )
$GETDOWNTXT = Join-Path -Path $APPDIR -ChildPath "getdown.txt"