Skip to content

Commit abdff91

Browse files
committed
Update CreateDeb to enhance environment variable handling with XDG support and improve default path logic
1 parent 62d3f42 commit abdff91

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

buildSrc/src/main/java/org/jackhuang/hmcl/gradle/pack/CreateDeb.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,17 @@ private String getLauncherScript() {
265265
return """
266266
#!/usr/bin/env bash
267267
cd "$HOME"
268-
if [ -z "${HMCL_USER_HOME+x}" ]; then
269-
export HMCL_USER_HOME="$HOME/.local/share/hmcl"
268+
if [ -z "${HMCL_USER_HOME:-}" ]; then
269+
if [ -z "${XDG_DATA_HOME:-}" ]; then
270+
export HMCL_USER_HOME="$HOME/.local/share/hmcl"
271+
else
272+
export HMCL_USER_HOME="$XDG_DATA_HOME/hmcl"
273+
fi
270274
fi
271-
if [ -z "${HMCL_LOCAL_HOME+x}" ]; then
275+
if [ -z "${HMCL_LOCAL_HOME:-}" ]; then
272276
export HMCL_LOCAL_HOME="$HMCL_USER_HOME/local-%s"
273277
fi
274-
if [ -z "${HMCL_DEPENDENCIES_DIR+x}" ]; then
278+
if [ -z "${HMCL_DEPENDENCIES_DIR:-}" ]; then
275279
export HMCL_DEPENDENCIES_DIR="$HMCL_USER_HOME/dependencies"
276280
fi
277281
exec %s "$@"

0 commit comments

Comments
 (0)