Update metatype registration in assetBakeTask

This commit is contained in:
Ryan Huffman 2017-12-06 13:59:46 -08:00
parent 6b098bfc6a
commit 2eecb41337
2 changed files with 10 additions and 4 deletions

View file

@ -11,6 +11,8 @@
#include "BakeAssetTask.h" #include "BakeAssetTask.h"
#include <mutex>
#include <QtCore/QThread> #include <QtCore/QThread>
#include <QCoreApplication> #include <QCoreApplication>
@ -20,14 +22,18 @@ static const int OVEN_STATUS_CODE_SUCCESS { 0 };
static const int OVEN_STATUS_CODE_FAIL { 1 }; static const int OVEN_STATUS_CODE_FAIL { 1 };
static const int OVEN_STATUS_CODE_ABORT { 2 }; static const int OVEN_STATUS_CODE_ABORT { 2 };
std::once_flag registerMetaTypesFlag;
BakeAssetTask::BakeAssetTask(const AssetHash& assetHash, const AssetPath& assetPath, const QString& filePath) : BakeAssetTask::BakeAssetTask(const AssetHash& assetHash, const AssetPath& assetPath, const QString& filePath) :
_assetHash(assetHash), _assetHash(assetHash),
_assetPath(assetPath), _assetPath(assetPath),
_filePath(filePath) _filePath(filePath)
{ {
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
std::call_once(registerMetaTypesFlag, []() {
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
});
} }
void cleanupTempFiles(QString tempOutputDir, std::vector<QString> files) { void cleanupTempFiles(QString tempOutputDir, std::vector<QString> files) {

View file

@ -98,11 +98,11 @@ int PathUtils::removeTemporaryApplicationDirs(QString appName) {
auto pid = match.capturedRef("pid").toLongLong(); auto pid = match.capturedRef("pid").toLongLong();
auto timestamp = match.capturedRef("timestamp"); auto timestamp = match.capturedRef("timestamp");
if (!processIsRunning(pid)) { if (!processIsRunning(pid)) {
qDebug() << " Removing old temporary directory: " << absoluteDirPath; qDebug() << " Removing old temporary directory: " << dir.absoluteFilePath();
absoluteDirPath.removeRecursively(); absoluteDirPath.removeRecursively();
removed++; removed++;
} else { } else {
qDebug() << " Not removing (process is running): " << dir.absoluteDir(); qDebug() << " Not removing (process is running): " << dir.absoluteFilePath();
} }
} }
} }