[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/kernel
From:       David Faure <faure () kde ! org>
Date:       2010-11-09 20:52:26
Message-ID: 20101109205226.7367BAC8A1 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1194772 by dfaure:

make "dir" a QString again


 M  +9 -14     kstandarddirs.cpp  


--- trunk/KDE/kdelibs/kdecore/kernel/kstandarddirs.cpp #1194771:1194772
@@ -964,15 +964,10 @@
     hostname[0] = 0;
     gethostname(hostname, 255);
     const QString localkdedir = m_prefixes.first();
-    // this will not work on windows when localkdedir contains
-    // characters not encodeable in the current locale
-    QByteArray dir = QFile::encodeName(localkdedir);
-    dir += type;
-    dir += '-';
-    dir += hostname;
+    QString dir = localkdedir + QString::fromLatin1(type) + QLatin1Char('-') + \
QString::fromLocal8Bit(hostname);  char link[1024];
     link[1023] = 0;
-    int result = readlink(dir.constData(), link, 1023);
+    int result = readlink(QFile::encodeName(dir).constData(), link, 1023);
     bool relink = (result == -1) && (errno == ENOENT);
     if (result > 0)
     {
@@ -1000,10 +995,10 @@
 #ifdef Q_WS_WIN
     if (relink)
     {
-        if (!makeDir(QFile::decodeName(dir), 0700))
-            fprintf(stderr, "failed to create \"%s\"", dir.constData());
+        if (!makeDir(dir, 0700))
+            fprintf(stderr, "failed to create \"%s\"", qPrintable(dir));
         else
-            result = readlink(dir.constData(), link, 1023);
+            result = readlink(QFile::encodeName(dir).constData(), link, 1023);
     }
 #else //UNIX
     if (relink)
@@ -1016,19 +1011,19 @@
             if (system(QFile::encodeName(srv) + ' ' + type) == -1) {
                 fprintf(stderr, "Error: unable to launch lnusertemp command" );
             }
-            result = readlink(dir.constData(), link, 1023);
+            result = readlink(QFile::encodeName(dir).constData(), link, 1023);
         }
     }
     if (result > 0)
     {
         link[result] = 0;
         if (link[0] == '/')
-            dir = link;
+            dir = QFile::decodeName(link);
         else
-            dir = QFile::encodeName(QDir::cleanPath(QFile::decodeName(dir + \
const_cast<const char *>(link)))); +            dir = QDir::cleanPath(dir + \
QFile::decodeName(link));  }
 #endif
-    q->addResourceDir(type, QFile::decodeName(dir + '/'), false);
+    q->addResourceDir(type, dir + QLatin1Char('/'), false);
 }
 
 QStringList KStandardDirs::resourceDirs(const char *type) const


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic