diff --git a/kdecore/kde-config.cpp b/kdecore/kde-config.cpp index 31211e72..ff5343f9 100644 --- a/kdecore/kde-config.cpp +++ b/kdecore/kde-config.cpp @@ -141,8 +141,7 @@ int main(int argc, char **argv) "xdgdata-mime", I18N_NOOP("XDG Mime Types"), "xdgconf-menu", I18N_NOOP("XDG Menu layout (.menu files)"), "xdgconf-autostart", I18N_NOOP("XDG autostart directory"), - "tmp", I18N_NOOP("Temporary files (specific for both current host and current user)"), - "socket", I18N_NOOP("UNIX Sockets (specific for both current host and current user)"), + "tmp", I18N_NOOP("Temporary files (specific for current user)"), 0, 0 }; Q_FOREACH(const QString &type, types) diff --git a/kdecore/kernel/kstandarddirs.cpp b/kdecore/kernel/kstandarddirs.cpp index e2b05396..69e6e065 100644 --- a/kdecore/kernel/kstandarddirs.cpp +++ b/kdecore/kernel/kstandarddirs.cpp @@ -59,6 +59,7 @@ #include #include #include +#include #include #include @@ -263,7 +264,6 @@ QStringList KStandardDirs::allTypes() const //list.append(QString::fromLatin1("home")); // undocumented on purpose, said Waldo in r113855. // Those are handled by resourceDirs() itself - list.append(QString::fromLatin1("socket")); list.append(QString::fromLatin1("tmp")); list.append(QString::fromLatin1("cache")); // Those are handled by installPath() @@ -854,12 +854,20 @@ KStandardDirs::realFilePath(const QString &filename) void KStandardDirs::KStandardDirsPrivate::createSpecialResource(const char *type) { - QString resourceDir = QDir::tempPath(); - resourceDir.append(QDir::separator()); - resourceDir.append(QLatin1String("kde-")); - resourceDir.append(QString::fromLatin1(type)); - resourceDir.append(QLatin1Char('-')); - resourceDir.append(QString::number(::getuid())); + QString resourceDir; + if (qstrcmp(type, "cache") == 0) { + resourceDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); + resourceDir.append(QDir::separator()); + resourceDir.append(QLatin1String("katana")); + } else if (qstrcmp(type, "tmp") == 0) { + resourceDir = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation); + // if the base directory is /tmp not /run/user/ make sure it is user specific + resourceDir.append(QDir::separator()); + resourceDir.append(QLatin1String("katana-")); + resourceDir.append(QString::number(::getuid())); + } else { + Q_ASSERT(false); + } q->addResourceDir(type, QDir::cleanPath(resourceDir) + QLatin1Char('/'), false); } @@ -886,11 +894,7 @@ QStringList KStandardDirs::KStandardDirsPrivate::resourceDirs(const char* type, else // filling cache { //qDebug() << this << "resourceDirs(" << type << "), not in cache"; - if (strcmp(type, "socket") == 0) - createSpecialResource(type); - else if (strcmp(type, "tmp") == 0) - createSpecialResource(type); - else if (strcmp(type, "cache") == 0) + if (strcmp(type, "tmp") == 0 || strcmp(type, "cache") == 0) createSpecialResource(type); QDir testdir; @@ -1184,12 +1188,9 @@ QString KStandardDirs::saveLocation(const char *type, if (path.isEmpty()) { QStringList dirs = d->m_relatives.value(type); - if (dirs.isEmpty() && ( - (strcmp(type, "socket") == 0) || - (strcmp(type, "tmp") == 0) || - (strcmp(type, "cache") == 0) )) + if (dirs.isEmpty() && (strcmp(type, "tmp") == 0 || strcmp(type, "cache") == 0)) { - (void) resourceDirs(type); // Generate socket|tmp|cache resource. + (void) resourceDirs(type); // Generate tmp|cache resource. dirs = d->m_relatives.value(type); // Search again. } if (!dirs.isEmpty()) diff --git a/kdecore/kernel/kstandarddirs.h b/kdecore/kernel/kstandarddirs.h index d4660e4f..eb25847a 100644 --- a/kdecore/kernel/kstandarddirs.h +++ b/kdecore/kernel/kstandarddirs.h @@ -78,8 +78,7 @@ class KConfig; * @li @c sound - Application sounds. * @li @c templates - Templates for the "Create new file" functionality. * @li @c wallpaper - Wallpapers. - * @li @c tmp - Temporary files (specific for both current host and current user) - * @li @c socket - UNIX Sockets (specific for both current host and current user) + * @li @c tmp - Temporary files (specific for current user) * @li @c xdgconf-menu - Freedesktop.org standard location for menu layout (.menu) files. * @li @c xdgdata-apps - Freedesktop.org standard location for application desktop files. * @li @c xdgdata-dirs - Freedesktop.org standard location for menu descriptions (.directory files). diff --git a/kinit/kinit.cpp b/kinit/kinit.cpp index e8083f89..372ab0c1 100644 --- a/kinit/kinit.cpp +++ b/kinit/kinit.cpp @@ -1305,7 +1305,7 @@ static void kdeinit_library_path() display.replace(':','_'); // WARNING, if you change the socket name, adjust kwrapper too const QString socketFileName = QString::fromLatin1("kdeinit4_%1").arg(QLatin1String(display)); - QByteArray socketName = QFile::encodeName(KStandardDirs::locateLocal("socket", socketFileName, *s_instance)); + QByteArray socketName = QFile::encodeName(KStandardDirs::locateLocal("tmp", socketFileName, *s_instance)); if (socketName.length() >= MAX_SOCK_FILE) { fprintf(stderr, "kdeinit4: Aborting. Socket name will be too long:\n");