diff --git a/lib/libsde.in b/lib/libsde.in index be2fac0..a779f6b 100644 --- a/lib/libsde.in +++ b/lib/libsde.in @@ -2,7 +2,7 @@ # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: lib/libsde.in -# Copyright (C) 2006 - 2010 The OpenSDE Project +# Copyright (C) 2006 - 2015 The OpenSDE Project # # More information can be found in the files COPYING and README. # @@ -23,8 +23,14 @@ sdever=$("$SDEROOT/lib/version.sh") # default settings # -[ -n "$SDESETTINGS" ] || SDESETTINGS="$HOME/.sde/settings" -export SDESETTINGS +if [ -z "$SDESETTINGS" ]; then + if [ -n "$SUDO_USER" ]; then + SDESETTINGS="$( getent passwd $SUDO_USER | cut -d: -f6)/.sde/settings" + else + SDESETTINGS="$HOME/.sde/settings" + fi + export SDESETTINGS +fi if [ ! -e "$SDESETTINGS" ]; then mkdir -p "${SDESETTINGS%/*}"