From 0b1b6007c63c303c4a3ac3bd722270ecf52c1149 Mon Sep 17 00:00:00 2001 From: Epicalert Date: Tue, 10 Sep 2024 05:27:35 +0800 Subject: [PATCH] Write to a proper temporary dir --- texturecrafter.cpp | 11 ++++++++++- texturecrafter.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/texturecrafter.cpp b/texturecrafter.cpp index 1a72ab9..5665c83 100644 --- a/texturecrafter.cpp +++ b/texturecrafter.cpp @@ -27,6 +27,7 @@ void TextureCrafter::packChannels(QVector 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 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 } diff --git a/texturecrafter.h b/texturecrafter.h index 8631ca6..c076641 100644 --- a/texturecrafter.h +++ b/texturecrafter.h @@ -4,6 +4,7 @@ #include #include #include +#include class TextureCrafter : public QObject { @@ -16,6 +17,7 @@ public: signals: private: + QTemporaryDir outDir; }; #endif // TEXTURECRAFTER_H