From ea0dd4ad23c4a74225d8f81e40ddcdffd97a7fbd Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 25 Nov 2010 09:43:23 +0100 Subject: [PATCH] JsDebugger: Open original file if breakpoint is hit Hotfix for Qt Quick Applications: Try to open the original file by stripping "X.app/Contents/Resources" from the path. Reviewed-by: Christiaan Janssen --- src/plugins/debugger/qml/qmlengine.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/debugger/qml/qmlengine.cpp b/src/plugins/debugger/qml/qmlengine.cpp index 1020419c1a5..9eb5ca02256 100644 --- a/src/plugins/debugger/qml/qmlengine.cpp +++ b/src/plugins/debugger/qml/qmlengine.cpp @@ -818,7 +818,7 @@ QString QmlEngine::mangleFilenamePaths(const QString &filename, const QString &o if (oldBaseDir.exists() && newBaseDir.exists() && fileInfo.exists()) { if (fileInfo.absoluteFilePath().startsWith(oldBaseDir.canonicalPath())) { - QString fileRelativePath = fileInfo.canonicalFilePath().mid(oldBasePath.length()); + QString fileRelativePath = fileInfo.canonicalFilePath().mid(oldBaseDir.canonicalPath().length()); QFileInfo projectFile(newBaseDir.canonicalPath() + QLatin1Char('/') + fileRelativePath); if (projectFile.exists()) @@ -833,7 +833,14 @@ QString QmlEngine::fromShadowBuildFilename(const QString &filename) const QString newFilename = filename; QString importPath = qmlImportPath(); - newFilename = mangleFilenamePaths(filename, startParameters().projectBuildDir, startParameters().projectDir); +#ifdef Q_OS_MACX + // Qt Quick Applications by default copy the qml directory to buildDir()/X.app/Contents/Resources + const QString applicationBundleDir + = QFileInfo(startParameters().executable).absolutePath() + "/../.."; + newFilename = mangleFilenamePaths(newFilename, applicationBundleDir + "/Contents/Resources", startParameters().projectDir); +#endif + newFilename = mangleFilenamePaths(newFilename, startParameters().projectBuildDir, startParameters().projectDir); + if (newFilename == filename && !importPath.isEmpty()) { newFilename = mangleFilenamePaths(filename, startParameters().projectBuildDir, importPath); }