Commit c3e2fd9e authored by Kai Koehne's avatar Kai Koehne Committed by con

Fix "File name case mismatch" error when debugging QML apps (Win)

Work around QTBUG-17529 by normalizing the capitalization of the
working directory (which we do already for launching apps without
debugging).

Task-number: QTCREATORBUG-4592
Reviewed-by: Friedemann Kleint
parent 3f6e418b
......@@ -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);
......
......@@ -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();
......
......@@ -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();
......
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment