From 9aa76c5c170093309d30ee1beb579824efa38edf Mon Sep 17 00:00:00 2001 From: Olli Helenius Date: Wed, 31 Jan 2018 12:01:12 +0200 Subject: [PATCH] Use XDG base directories by default on Unix --- visualvm/launcher/visualvm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/visualvm/launcher/visualvm b/visualvm/launcher/visualvm index 1056079240..d1cab98f0a 100644 --- a/visualvm/launcher/visualvm +++ b/visualvm/launcher/visualvm @@ -56,8 +56,17 @@ case "`uname`" in ;; *) # set default userdir and cachedir on unix systems - DEFAULT_USERDIR_ROOT=${HOME}/.visualvm + if [ -d "${HOME}/.visualvm" ] ; then + DEFAULT_USERDIR_ROOT=${HOME}/.visualvm + elif [ -n "$XDG_DATA_HOME" ] ; then + DEFAULT_USERDIR_ROOT=${XDG_DATA_HOME}/visualvm + else + DEFAULT_USERDIR_ROOT=${HOME}/.local/share/visualvm + fi DEFAULT_CACHEDIR_ROOT=${HOME}/.cache/visualvm + if [ ! -d "$DEFAULT_CACHEDIR_ROOT" -a -n "$XDG_CACHE_HOME" ] ; then + DEFAULT_CACHEDIR_ROOT=${XDG_CACHE_HOME}/visualvm + fi ;; esac