From a1602e0cf6d615d5ce1c54b3bc006073eb74b05d Mon Sep 17 00:00:00 2001 From: tpearson Date: Thu, 16 Sep 2010 22:36:03 +0000 Subject: Autodetect usage of KDEROOTHOME variable git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1176194 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdecore/kstandarddirs.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'kdecore') diff --git a/kdecore/kstandarddirs.cpp b/kdecore/kstandarddirs.cpp index 800c0e191..f8b7bd307 100644 --- a/kdecore/kstandarddirs.cpp +++ b/kdecore/kstandarddirs.cpp @@ -1320,7 +1320,15 @@ void KStandardDirs::addKDEDefaults() // We treat root differently to prevent a "su" shell messing up the // file permissions in the user's home directory. - TQString localKdeDir = readEnvPath(getuid() ? "KDEHOME" : "KDEROOTHOME"); + TQString localKdeDir; + if (getuid() == 0) { + localKdeDir = readEnvPath("KDEROOTHOME"); + if (localKdeDir.isEmpty() == true) + localKdeDir = readEnvPath("KDEHOME"); + } + else { + localKdeDir = readEnvPath("KDEHOME"); + } if (!localKdeDir.isEmpty()) { if (localKdeDir[localKdeDir.length()-1] != QChar('/')) -- cgit v1.2.1