Write to a proper temporary dir

This commit is contained in:
Epicalert 2024-09-10 05:27:35 +08:00
parent 3fe4a536c5
commit 0b1b6007c6
2 changed files with 12 additions and 1 deletions

View file

@ -27,6 +27,7 @@ void TextureCrafter::packChannels(QVector<QUrl> imagePaths) {
QImage outImage(width, height, format);
// do the channel packing!!
// theres probably a faster way to do this but eh
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
@ -43,7 +44,15 @@ void TextureCrafter::packChannels(QVector<QUrl> imagePaths) {
}
}
outImage.save("/tmp/out.png");
// write it to a temp file
if (outDir.isValid()) {
QString outFileName = outDir.path();
outFileName.append("/out.png");
outImage.save(outFileName);
} else {
// chat its so over
}
//do we need to close these??? idk lets hope qt handles it
}

View file

@ -4,6 +4,7 @@
#include <QObject>
#include <QQmlEngine>
#include <QImage>
#include <QTemporaryDir>
class TextureCrafter : public QObject
{
@ -16,6 +17,7 @@ public:
signals:
private:
QTemporaryDir outDir;
};
#endif // TEXTURECRAFTER_H