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

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
parent f9ba7536
Branches
Tags
No related merge requests found
...@@ -818,7 +818,7 @@ QString QmlEngine::mangleFilenamePaths(const QString &filename, const QString &o ...@@ -818,7 +818,7 @@ QString QmlEngine::mangleFilenamePaths(const QString &filename, const QString &o
if (oldBaseDir.exists() && newBaseDir.exists() && fileInfo.exists()) { if (oldBaseDir.exists() && newBaseDir.exists() && fileInfo.exists()) {
if (fileInfo.absoluteFilePath().startsWith(oldBaseDir.canonicalPath())) { 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); QFileInfo projectFile(newBaseDir.canonicalPath() + QLatin1Char('/') + fileRelativePath);
if (projectFile.exists()) if (projectFile.exists())
...@@ -833,7 +833,14 @@ QString QmlEngine::fromShadowBuildFilename(const QString &filename) const ...@@ -833,7 +833,14 @@ QString QmlEngine::fromShadowBuildFilename(const QString &filename) const
QString newFilename = filename; QString newFilename = filename;
QString importPath = qmlImportPath(); 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()) { if (newFilename == filename && !importPath.isEmpty()) {
newFilename = mangleFilenamePaths(filename, startParameters().projectBuildDir, importPath); newFilename = mangleFilenamePaths(filename, startParameters().projectBuildDir, importPath);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment