diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp index df8c1678bd8..fb946d9ca1c 100644 --- a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp @@ -465,7 +465,11 @@ namespace QTest { "SOURCES += project.cpp\n" "QT -= core gui\n" "INCLUDEPATH += . "); - projectFile.write(QFile::encodeName(QDir::currentPath())); + + QString workingDir = QDir::currentPath(); + if (extraProgramSources.count() > 0) + workingDir = QFileInfo(extraProgramSources.first()).absolutePath(); + projectFile.write(QFile::encodeName(workingDir)); #ifndef QT_NO_DEBUG projectFile.write("\nCONFIG += debug\n");