diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index 535e4eebe7d66417910f9883bed09b6a7835cfe8..39bc441bda9e73a025fdaea4d66c5fefab4ef8a1 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -1933,6 +1933,24 @@ const Value *Function::invoke(const Activation *activation) const // typing environment //////////////////////////////////////////////////////////////////////////////// +CppQmlTypesLoader::CppQmlTypesLoader() +{ + QDir qmldumpExecutable(QCoreApplication::applicationDirPath()); +#ifndef Q_OS_WIN + m_qmldumpPath = qmldumpExecutable.absoluteFilePath(QLatin1String("qmldump")); +#else + m_qmldumpPath = qmldumpExecutable.absoluteFilePath(QLatin1String("qmldump.exe")); +#endif + QFileInfo qmldumpFileInfo(m_qmldumpPath); + if (!qmldumpFileInfo.exists()) { + qWarning() << "QmlJS::Interpreter::CppQmlTypesLoader: qmldump executable does not exist at" << m_qmldumpPath; + m_qmldumpPath.clear(); + } else if (!qmldumpFileInfo.isFile()) { + qWarning() << "QmlJS::Interpreter::CppQmlTypesLoader: " << m_qmldumpPath << " is not a file"; + m_qmldumpPath.clear(); + } +} + CppQmlTypesLoader *CppQmlTypesLoader::instance() { static CppQmlTypesLoader _instance; @@ -1966,10 +1984,12 @@ QStringList CppQmlTypesLoader::load(const QFileInfoList &xmlFiles) void CppQmlTypesLoader::loadPluginTypes(const QString &pluginPath) { + if (m_qmldumpPath.isEmpty()) + return; + QProcess *process = new QProcess(this); connect(process, SIGNAL(finished(int)), SLOT(processDone(int))); - QDir qmldumpExecutable(QCoreApplication::applicationDirPath()); - process->start(qmldumpExecutable.filePath("qmldump"), QStringList(pluginPath)); + process->start(m_qmldumpPath, QStringList(pluginPath)); } void CppQmlTypesLoader::processDone(int exitCode) diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 69ad2427a8179ab6915ba000aa6ccacc84ef458f..ffa53b869ef615c04df96cfc478c69e144a250b0 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -516,6 +516,7 @@ class QMLJS_EXPORT CppQmlTypesLoader : public QObject { Q_OBJECT public: + CppQmlTypesLoader(); static CppQmlTypesLoader *instance(); QHash<QString, FakeMetaObject *> objects; @@ -530,6 +531,7 @@ private slots: private: void addObjects(QMap<QString, FakeMetaObject *> &newObjects); + QString m_qmldumpPath; }; class QMLJS_EXPORT CppQmlTypes