diff --git a/src/libs/utils/winutils.cpp b/src/libs/utils/winutils.cpp index 7ed6909f2f19a0ba241cf8935002deaaa0b7a918..f19bdfefbe49f0565fb07c7eb501ab91b8690e00 100644 --- a/src/libs/utils/winutils.cpp +++ b/src/libs/utils/winutils.cpp @@ -163,6 +163,19 @@ QTCREATOR_UTILS_EXPORT QString getLongPathName(const QString &name) return rc; } +// makes sure that capitalization of directories is canonical. +// This mimics the logic in QDeclarative_isFileCaseCorrect +QTCREATOR_UTILS_EXPORT QString normalizePathName(const QString &name) +{ + QString canonicalName = getShortPathName(name); + if (canonicalName.isEmpty()) + return name; + canonicalName = getLongPathName(canonicalName); + if (canonicalName.isEmpty()) + return name; + return canonicalName; +} + QTCREATOR_UTILS_EXPORT unsigned long winQPidToPid(const Q_PID qpid) { const PROCESS_INFORMATION *processInfo = reinterpret_cast<const PROCESS_INFORMATION*>(qpid); diff --git a/src/libs/utils/winutils.h b/src/libs/utils/winutils.h index 92ca1f157835697e92080258247f252dc70230aa..caf9f9476a52218f6c35b0aa34df5c8ff71acc43 100644 --- a/src/libs/utils/winutils.h +++ b/src/libs/utils/winutils.h @@ -59,6 +59,9 @@ QTCREATOR_UTILS_EXPORT QString getShortPathName(const QString &name); // Returns long name QTCREATOR_UTILS_EXPORT QString getLongPathName(const QString &name); +// Returns long name with canonical capitalization. +QTCREATOR_UTILS_EXPORT QString normalizePathName(const QString &name); + QTCREATOR_UTILS_EXPORT unsigned long winQPidToPid(const Q_PID qpid); QTCREATOR_UTILS_EXPORT bool winIs64BitSystem(); diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index 752ef2071104d7b7d5d55b507ff1dc322f77442a..93fd15cb6b6ba616de6be6c4432060546be380d1 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -46,6 +46,7 @@ #ifdef Q_OS_WIN # include "peutils.h" +# include <utils/winutils.h> #endif #include <projectexplorer/abi.h> @@ -675,6 +676,12 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu sp.startMode = StartInternal; sp.environment = rc->environment(); sp.workingDirectory = rc->workingDirectory(); + +#if defined(Q_OS_WIN) + // Work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch' ...) + sp.workingDirectory = Utils::normalizePathName(sp.workingDirectory); +#endif + sp.executable = rc->executable(); sp.processArgs = rc->commandLineArguments(); sp.toolChainAbi = rc->abi(); diff --git a/src/plugins/projectexplorer/applicationlauncher_win.cpp b/src/plugins/projectexplorer/applicationlauncher_win.cpp index 5ecf5f5e5eded0c7ccbc8cd155e37a74c54c7a33..8a726c92a5a5204c9cab5df580ac1ffd5d620102 100644 --- a/src/plugins/projectexplorer/applicationlauncher_win.cpp +++ b/src/plugins/projectexplorer/applicationlauncher_win.cpp @@ -71,10 +71,7 @@ ApplicationLauncher::~ApplicationLauncher() void ApplicationLauncher::setWorkingDirectory(const QString &dir) { // Work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch' ...) - QString fixedPath = dir; - const QString longPath = Utils::getLongPathName(dir); - if (!longPath.isEmpty()) - fixedPath = longPath; + const QString fixedPath = Utils::normalizePathName(dir); d->m_winGuiProcess.setWorkingDirectory(fixedPath); d->m_consoleProcess.setWorkingDirectory(fixedPath); diff --git a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp index 627ce5d331ee3c1882520f3f38793704fc1530c9..d53e8f7cbb4f0a3689286331e10f08e1e28d6df0 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.cpp @@ -45,7 +45,7 @@ #include <qt4projectmanager/qtoutputformatter.h> #include <qt4projectmanager/qt4projectmanagerconstants.h> -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN #include <utils/winutils.h> #endif @@ -180,20 +180,13 @@ void QmlProjectRunConfiguration::setQtVersionId(int id) } /* QtDeclarative checks explicitly that the capitalization for any URL / path - is exactly like the capitalization on disk. This method is uses the same - native Windows API's to get the exact canonical path. */ + is exactly like the capitalization on disk.*/ QString QmlProjectRunConfiguration::canonicalCapsPath(const QString &fileName) { QString canonicalPath = QFileInfo(fileName).canonicalFilePath(); -#if defined(Q_OS_WIN32) - // don't know whether the shortpath step is really needed, - // but we do this in QtDeclarative too. - QString path = Utils::getShortPathName(canonicalPath); - if (!path.isEmpty()) - path = Utils::getLongPathName(canonicalPath); - if (!path.isEmpty()) - canonicalPath = path; +#if defined(Q_OS_WIN) + canonicalPath = Utils::normalizePathName(canonicalPath); #endif return canonicalPath;