Add plugs which use the personal-files interface for snaps to allow the users to enable OpenRocket to access the ~/.java and ~/.openrocket directories. Currently, these must be manually connected by the user, so the launcher is updated to ensure the user experience degrades appropriately when they are not connected. This method allows for new installations to OpenRocket without any changes and for users migrating to the snap from the jar to be able to connect their existing preferences and databases. Signed-off-by: Billy Olsen <billy.olsen@gmail.com>
24 lines
802 B
Bash
Executable File
24 lines
802 B
Bash
Executable File
#!/bin/bash
|
|
|
|
JAVA_BIN="$JAVA_HOME/bin/java"
|
|
|
|
export DESKTOP_SESSION=gnome
|
|
export XDG_SESSION_DESKTOP=gnome
|
|
export XDG_CURRENT_DESKTOP=GNOME
|
|
|
|
JAVA_OPTS="-Dsun.java2d.xrender=true -Dprism.useFontConfig=false -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -Djava.io.tmpdir=$SNAP_USER_COMMON"
|
|
|
|
if ! snapctl is-connected preferences; then
|
|
JAVA_OPTS="$JAVA_OPTS -Djava.util.prefs.userRoot=$SNAP_USER_COMMON/"
|
|
fi
|
|
|
|
if ! snapctl is-connected openrocket-db; then
|
|
JAVA_OPTS="$JAVA_OPTS -Duser.home=$SNAP_USER_COMMON/"
|
|
fi
|
|
|
|
export _JAVA_OPTIONS=$JAVA_OPTS
|
|
# Fix font / theme
|
|
export JAVA_FONTS=$SNAP/usr/share/fonts/truetype
|
|
exec $JAVA_BIN -jar $SNAP/OpenRocket.jar "$@"
|
|
|