Use QFile::{encode,decode}Name to deal with QT_PLUGIN_PATH
authorThiago Macieira <thiago.macieira@intel.com>
Wed, 2 May 2012 13:36:35 +0000 (15:36 +0200)
committerQt by Nokia <qt-info@nokia.com>
Fri, 4 May 2012 13:24:52 +0000 (15:24 +0200)
Since it deals with paths, let's use the proper path-handling
functions.

Change-Id: I896d2c472dfd675e9ff247657447178702f178be
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
src/corelib/kernel/qcoreapplication.cpp
tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp

index 5d70c4c..dad6c62 100644 (file)
@@ -2055,7 +2055,7 @@ QStringList QCoreApplication::libraryPaths()
 #else
             QLatin1Char pathSep(':');
 #endif
-            QStringList paths = QString::fromLatin1(libPathEnv).split(pathSep, QString::SkipEmptyParts);
+            QStringList paths = QFile::decodeName(libPathEnv).split(pathSep, QString::SkipEmptyParts);
             for (QStringList::const_iterator it = paths.constBegin(); it != paths.constEnd(); ++it) {
                 QString canonicalPath = QDir(*it).canonicalPath();
                 if (!canonicalPath.isEmpty()
index 288e41c..bed191d 100644 (file)
@@ -955,7 +955,7 @@ void tst_QApplication::libraryPaths_qt_plugin_path()
 
     // Our hook into libraryPaths() initialization: Set the QT_PLUGIN_PATH environment variable
     QString installPathPluginsDeCanon = appDirPath + QString::fromLatin1("/tmp/..");
-    QByteArray ascii = installPathPluginsDeCanon.toAscii();
+    QByteArray ascii = QFile::encodeName(installPathPluginsDeCanon);
     qputenv("QT_PLUGIN_PATH", ascii);
 
     QVERIFY(!app.libraryPaths().contains(appDirPath + QString::fromLatin1("/tmp/..")));