Skip to content

Commit

Permalink
devonfw#638: windows support .exe .cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
tobka777 committed Feb 7, 2022
1 parent 9a4fcdc commit a486feb
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions scripts/src/main/resources/scripts/command/graalvm
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,35 @@ function doSetup() {
fi
if [ "${1}" != "silent" ] && ! doIsQuiet
then
doRunCommand "'${GRAALVM_HOME}/bin/java' -version" "verify installation of GraalVM"
local java_binary="${GRAALVM_HOME}/bin/java"
if [ ! -f "${java_binary}" ]
then
java_binary="${GRAALVM_HOME}/bin/java.exe"
fi
doRunCommand "'${java_binary}' -version" "verify installation of GraalVM"
fi
export GRAALVM_HOME="{$GRAALVM_HOME}"
export GRAALVM_HOME="$GRAALVM_HOME"
}

# Call GraalVM with specified arguments
function doRun() {
doSetup silent
command="${GRAALVM_HOME}/bin/$*"
if [ -f "$( echo "$command" | cut -d ' ' -f1 )" ]
command="$GRAALVM_HOME/bin/$*"
local binary=${command%% *}
local subcommand=${command/"$binary"/}
if [ -f "${binary}" ]
then
binary=${binary}
elif [ -f "${binary}.exe" ]
then
binary=${binary}".exe"
else
binary=${binary}".cmd"
fi

if [ -f "${binary}" ]
then
${command}
"${binary}" ${subcommand}
else
doFail "Command not found"
fi
Expand Down

0 comments on commit a486feb

Please sign in to comment.