Skip to content
Snippets Groups Projects
Commit fa79add2 authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS: Check for existance of qmldump binary before using it.

parent f9d78727
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -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
......
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