summarylogtreecommitdiffstats
path: root/launcher.sh
diff options
context:
space:
mode:
Diffstat (limited to 'launcher.sh')
-rw-r--r--launcher.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/launcher.sh b/launcher.sh
new file mode 100644
index 000000000000..a6cb2988a158
--- /dev/null
+++ b/launcher.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+if [[ "$0" =~ / ]]; then
+ read app_path < <(realpath -- "$0")
+else
+ if hash "$0" &> /dev/null; then
+ read app_path < <(hash -t "$0")
+ else
+ if [ -f "./$0" ]; then
+ read app_path < <(realpath -- "./$0")
+ fi
+ fi
+fi
+
+if [ -z "$app_path" ]; then
+ app_path=/usr/bin
+else
+ read app_path < <(dirname -- "$app_path")
+fi
+
+app_path+="/../lib/daydreamer/"
+
+if [ -n "$1" ] && [ -f "$1" ]; then
+ read game_file_path < <(realpath "$1")
+fi
+
+launch_app() {
+ if [ -n "$1" ]; then
+ if [ -f "$app_path/$1" ]; then
+ if [ -n "$game_file_path" ]; then
+ exec -- java -jar "$app_path/$1" "$game_file_path"
+ else
+ exec -- java -jar "$app_path/$1"
+ fi
+ else
+ printf -- "ā€ž%sā€: file not found" "$app_path/$1" >&2
+ exit 1
+ fi
+ exit 255
+ fi
+}
+