summarylogtreecommitdiffstats
path: root/hmcl-launch-script
blob: c73bcd224955d54ddd2487981f30e60e55c03309 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

if [[ "$1" != "-p" ]]; then
  WORKDIR=${XDG_CONFIG_HOME:-$HOME/.config}/hmcl
  mkdir -p $WORKDIR
  cd $WORKDIR
fi

JAVA_HOME=/usr/lib/jvm/$(pacman -Ql java-openjfx | grep javafx | head -n 1 | cut -d / -f 5)

if [ -n "$(pacman -Ql java-openjfx | grep javafx | head -n 1 | cut -d / -f 5)" ]; then
  export PATH="$JAVA_HOME/bin:$PATH"
  exec java --module-path "${JAVA_HOME}/lib/javafx.base.jar:${JAVA_HOME}/lib/javafx.fxml.jar:${JAVA_HOME}/lib/javafx.graphics.jar:${JAVA_HOME}/lib/javafx.media.jar:${JAVA_HOME}/lib/javafx.swing.jar:${JAVA_HOME}/lib/javafx.web.jar:${JAVA_HOME}/lib/javafx.controls.jar" --add-modules=javafx.base --add-modules=javafx.fxml --add-modules=javafx.graphics --add-modules=javafx.media --add-modules=javafx.swing --add-modules=javafx.web --add-modules=javafx.controls -jar /usr/share/java/hmcl-bin/hmcl-bin.jar "$@"
else
  exec java -jar /usr/share/java/hmcl-bin/hmcl-bin.jar "$@"
fi