Skip to content

Commit

Permalink
feat: support $XDG_DATA_HOME if it is set (#190)
Browse files Browse the repository at this point in the history
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
  • Loading branch information
Maciej Barć committed Jun 25, 2023
1 parent 9394993 commit f8aba8b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libexec/swiftenv
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
set -e

if [ -z "$SWIFTENV_ROOT" ]; then
SWIFTENV_ROOT=$HOME/.swiftenv
if [[ -n "${XDG_DATA_HOME}" ]] && [[ ! -d "${HOME}"/.swiftenv ]]; then
SWIFTENV_ROOT="${XDG_DATA_HOME}"/swiftenv
else
SWIFTENV_ROOT="${HOME}"/.swiftenv
fi
fi
if [ ! -d "$SWIFTENV_ROOT" ]; then
mkdir "$SWIFTENV_ROOT"
mkdir -p "${SWIFTENV_ROOT}"
fi
export SWIFTENV_ROOT

Expand Down

0 comments on commit f8aba8b

Please sign in to comment.