forked from qt-creator/qt-creator
QmlJS: Check for existance of qmldump binary before using it.
This commit is contained in:
@@ -1933,6 +1933,24 @@ const Value *Function::invoke(const Activation *activation) const
|
|||||||
// typing environment
|
// 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()
|
CppQmlTypesLoader *CppQmlTypesLoader::instance()
|
||||||
{
|
{
|
||||||
static CppQmlTypesLoader _instance;
|
static CppQmlTypesLoader _instance;
|
||||||
@@ -1966,10 +1984,12 @@ QStringList CppQmlTypesLoader::load(const QFileInfoList &xmlFiles)
|
|||||||
|
|
||||||
void CppQmlTypesLoader::loadPluginTypes(const QString &pluginPath)
|
void CppQmlTypesLoader::loadPluginTypes(const QString &pluginPath)
|
||||||
{
|
{
|
||||||
|
if (m_qmldumpPath.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
QProcess *process = new QProcess(this);
|
QProcess *process = new QProcess(this);
|
||||||
connect(process, SIGNAL(finished(int)), SLOT(processDone(int)));
|
connect(process, SIGNAL(finished(int)), SLOT(processDone(int)));
|
||||||
QDir qmldumpExecutable(QCoreApplication::applicationDirPath());
|
process->start(m_qmldumpPath, QStringList(pluginPath));
|
||||||
process->start(qmldumpExecutable.filePath("qmldump"), QStringList(pluginPath));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppQmlTypesLoader::processDone(int exitCode)
|
void CppQmlTypesLoader::processDone(int exitCode)
|
||||||
|
@@ -516,6 +516,7 @@ class QMLJS_EXPORT CppQmlTypesLoader : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
CppQmlTypesLoader();
|
||||||
static CppQmlTypesLoader *instance();
|
static CppQmlTypesLoader *instance();
|
||||||
|
|
||||||
QHash<QString, FakeMetaObject *> objects;
|
QHash<QString, FakeMetaObject *> objects;
|
||||||
@@ -530,6 +531,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void addObjects(QMap<QString, FakeMetaObject *> &newObjects);
|
void addObjects(QMap<QString, FakeMetaObject *> &newObjects);
|
||||||
|
QString m_qmldumpPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QMLJS_EXPORT CppQmlTypes
|
class QMLJS_EXPORT CppQmlTypes
|
||||||
|
Reference in New Issue
Block a user