Add removal of temporary files in FBXBaker

This commit is contained in:
Ryan Huffman 2017-09-26 15:37:14 -07:00
parent 218d58df81
commit de2c1aabac
3 changed files with 14 additions and 0 deletions

View file

@ -18,6 +18,8 @@ class Baker : public QObject {
Q_OBJECT
public:
virtual ~Baker() = default;
bool shouldStop();
bool hasErrors() const { return !_errorList.isEmpty(); }

View file

@ -56,6 +56,17 @@ FBXBaker::FBXBaker(const QUrl& fbxURL, TextureBakerThreadGetter textureThreadGet
}
FBXBaker::~FBXBaker() {
if (_tempDir.exists()) {
if (!_tempDir.remove(_originalFBXFilePath)) {
qCWarning(model_baking) << "Failed to remove temporary copy of fbx file:" << _originalFBXFilePath;
}
if (!_tempDir.rmdir(".")) {
qCWarning(model_baking) << "Failed to remove temporary directory:" << _tempDir;
}
}
}
void FBXBaker::abort() {
Baker::abort();

View file

@ -35,6 +35,7 @@ class FBXBaker : public Baker {
public:
FBXBaker(const QUrl& fbxURL, TextureBakerThreadGetter textureThreadGetter,
const QString& bakedOutputDir, const QString& originalOutputDir = "");
~FBXBaker() override;
QUrl getFBXUrl() const { return _fbxURL; }
QString getBakedFBXFilePath() const { return _bakedFBXFilePath; }