Skip to content
Snippets Groups Projects
Commit c3e2fd9e authored by Kai Koehne's avatar Kai Koehne Committed by con
Browse files

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
No related branches found
No related tags found
No related merge requests found
...@@ -163,6 +163,19 @@ QTCREATOR_UTILS_EXPORT QString getLongPathName(const QString &name) ...@@ -163,6 +163,19 @@ QTCREATOR_UTILS_EXPORT QString getLongPathName(const QString &name)
return rc; 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) QTCREATOR_UTILS_EXPORT unsigned long winQPidToPid(const Q_PID qpid)
{ {
const PROCESS_INFORMATION *processInfo = reinterpret_cast<const PROCESS_INFORMATION*>(qpid); const PROCESS_INFORMATION *processInfo = reinterpret_cast<const PROCESS_INFORMATION*>(qpid);
......
...@@ -59,6 +59,9 @@ QTCREATOR_UTILS_EXPORT QString getShortPathName(const QString &name); ...@@ -59,6 +59,9 @@ QTCREATOR_UTILS_EXPORT QString getShortPathName(const QString &name);
// Returns long name // Returns long name
QTCREATOR_UTILS_EXPORT QString getLongPathName(const QString &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 unsigned long winQPidToPid(const Q_PID qpid);
QTCREATOR_UTILS_EXPORT bool winIs64BitSystem(); QTCREATOR_UTILS_EXPORT bool winIs64BitSystem();
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
# include "peutils.h" # include "peutils.h"
# include <utils/winutils.h>
#endif #endif
#include <projectexplorer/abi.h> #include <projectexplorer/abi.h>
...@@ -675,6 +676,12 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu ...@@ -675,6 +676,12 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
sp.startMode = StartInternal; sp.startMode = StartInternal;
sp.environment = rc->environment(); sp.environment = rc->environment();
sp.workingDirectory = rc->workingDirectory(); 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.executable = rc->executable();
sp.processArgs = rc->commandLineArguments(); sp.processArgs = rc->commandLineArguments();
sp.toolChainAbi = rc->abi(); sp.toolChainAbi = rc->abi();
......
...@@ -71,10 +71,7 @@ ApplicationLauncher::~ApplicationLauncher() ...@@ -71,10 +71,7 @@ ApplicationLauncher::~ApplicationLauncher()
void ApplicationLauncher::setWorkingDirectory(const QString &dir) void ApplicationLauncher::setWorkingDirectory(const QString &dir)
{ {
// Work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch' ...) // Work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch' ...)
QString fixedPath = dir; const QString fixedPath = Utils::normalizePathName(dir);
const QString longPath = Utils::getLongPathName(dir);
if (!longPath.isEmpty())
fixedPath = longPath;
d->m_winGuiProcess.setWorkingDirectory(fixedPath); d->m_winGuiProcess.setWorkingDirectory(fixedPath);
d->m_consoleProcess.setWorkingDirectory(fixedPath); d->m_consoleProcess.setWorkingDirectory(fixedPath);
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
#include <qt4projectmanager/qtoutputformatter.h> #include <qt4projectmanager/qtoutputformatter.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h> #include <qt4projectmanager/qt4projectmanagerconstants.h>
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN
#include <utils/winutils.h> #include <utils/winutils.h>
#endif #endif
...@@ -180,20 +180,13 @@ void QmlProjectRunConfiguration::setQtVersionId(int id) ...@@ -180,20 +180,13 @@ void QmlProjectRunConfiguration::setQtVersionId(int id)
} }
/* QtDeclarative checks explicitly that the capitalization for any URL / path /* QtDeclarative checks explicitly that the capitalization for any URL / path
is exactly like the capitalization on disk. This method is uses the same is exactly like the capitalization on disk.*/
native Windows API's to get the exact canonical path. */
QString QmlProjectRunConfiguration::canonicalCapsPath(const QString &fileName) QString QmlProjectRunConfiguration::canonicalCapsPath(const QString &fileName)
{ {
QString canonicalPath = QFileInfo(fileName).canonicalFilePath(); QString canonicalPath = QFileInfo(fileName).canonicalFilePath();
#if defined(Q_OS_WIN32) #if defined(Q_OS_WIN)
// don't know whether the shortpath step is really needed, canonicalPath = Utils::normalizePathName(canonicalPath);
// but we do this in QtDeclarative too.
QString path = Utils::getShortPathName(canonicalPath);
if (!path.isEmpty())
path = Utils::getLongPathName(canonicalPath);
if (!path.isEmpty())
canonicalPath = path;
#endif #endif
return canonicalPath; return canonicalPath;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment