Commit 54a04e68 authored by Marco Benelli's avatar Marco Benelli Committed by Tim Jenssen

QmlJs: qmlplugindump working directory

Use the plugin's parent path as working directory for the qmlplugindump
process.  This should be more reliable with regards to paths that
include symbolic links to shared or remote volumes.
Using the plugin's parent path will also be needed in order to handle
relative paths passed to the dumper (ie: with the -dependencies
option). This feature is not yet implemented in QtCreator.

Change-Id: I9c863a95d03fc7d03c84e704e39f2e0520aaa01e
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@theqtcompany.com>
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent 3ff007d5
...@@ -515,8 +515,12 @@ void PluginDumper::loadQmltypesFile(const QStringList &qmltypesFilePaths, ...@@ -515,8 +515,12 @@ void PluginDumper::loadQmltypesFile(const QStringList &qmltypesFilePaths,
void PluginDumper::runQmlDump(const QmlJS::ModelManagerInterface::ProjectInfo &info, void PluginDumper::runQmlDump(const QmlJS::ModelManagerInterface::ProjectInfo &info,
const QStringList &arguments, const QString &importPath) const QStringList &arguments, const QString &importPath)
{ {
QDir wd = QDir(importPath);
wd.cdUp();
QProcess *process = new QProcess(this); QProcess *process = new QProcess(this);
process->setEnvironment(info.qmlDumpEnvironment.toStringList()); process->setEnvironment(info.qmlDumpEnvironment.toStringList());
QString workingDir = wd.canonicalPath();
process->setWorkingDirectory(workingDir);
connect(process, static_cast<void (QProcess::*)(int)>(&QProcess::finished), connect(process, static_cast<void (QProcess::*)(int)>(&QProcess::finished),
this, &PluginDumper::qmlPluginTypeDumpDone); this, &PluginDumper::qmlPluginTypeDumpDone);
connect(process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error), connect(process, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error),
...@@ -567,7 +571,7 @@ void PluginDumper::dump(const Plugin &plugin) ...@@ -567,7 +571,7 @@ void PluginDumper::dump(const Plugin &plugin)
args << QLatin1String("-nonrelocatable"); args << QLatin1String("-nonrelocatable");
args << plugin.importUri; args << plugin.importUri;
args << plugin.importVersion; args << plugin.importVersion;
args << plugin.importPath; args << (plugin.importPath.isEmpty() ? QLatin1String(".") : plugin.importPath);
runQmlDump(info, args, plugin.qmldirPath); runQmlDump(info, args, plugin.qmldirPath);
} }
......
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