summaryrefslogtreecommitdiffstats
path: root/dcop/client/dcop.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dcop/client/dcop.cpp')
-rw-r--r--dcop/client/dcop.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/dcop/client/dcop.cpp b/dcop/client/dcop.cpp
index 8aa1ea59d..698479612 100644
--- a/dcop/client/dcop.cpp
+++ b/dcop/client/dcop.cpp
@@ -594,9 +594,29 @@ int runDCOP( QCStringList args, UserList users, Session session,
( getenv( "ICEAUTHORITY" ) == 0 || getenv( "DISPLAY" ) == 0 ) ) )
{
// Check for ICE authority file and if the file can be read by us
- TQString home = it.data();
- TQString iceFile = it.data() + "/.ICEauthority";
- TQFileInfo fi( iceFile );
+ TQString iceFileBase = "ICEauthority";
+ TQString iceFile;
+ TQFileInfo fi;
+
+ if (getenv("XDG_RUNTIME_DIR") != 0 )
+ {
+ TQFileInfo xdgRuntime(getenv("XDG_RUNTIME_DIR"));
+ passwd* pstruct = getpwnam(it.key().local8Bit());
+ if (pstruct)
+ {
+ iceFile = TQString("%1/%2/%3").arg(xdgRuntime.dirPath()).arg(pstruct->pw_uid).arg(iceFileBase);
+ fi.setFile(iceFile);
+ }
+ if (!pstruct || !fi.exists())
+ {
+ iceFile = TQString::null;
+ }
+ }
+ if (iceFile.isEmpty())
+ {
+ iceFile = TQString("%1/.%2").arg(it.data()).arg(iceFileBase);
+ fi.setFile(iceFile);
+ }
if( iceFile.isEmpty() )
{
cerr_ << "WARNING: Cannot determine home directory for user "