From 3820b77ace1c33629eb306d7d60ce63a35f0b1a3 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sun, 31 Dec 2023 10:31:21 -0500 Subject: [PATCH] Ensure mdl folder exists before export --- armoury/src/singlegearview.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/armoury/src/singlegearview.cpp b/armoury/src/singlegearview.cpp index e3e55f4..80bc1eb 100644 --- a/armoury/src/singlegearview.cpp +++ b/armoury/src/singlegearview.cpp @@ -351,8 +351,14 @@ void SingleGearView::importModel(const QString &filename) KConfigGroup game = config.group(QStringLiteral("Armoury")); QString outputDirectory = game.readEntry(QStringLiteral("PenumbraOutputDirectory")); + QFileInfo info(QStringLiteral("%1/%2").arg(outputDirectory, gearView->getLoadedGearPath())); + auto buffer = physis_mdl_write(&mdl.model); QFile file(QStringLiteral("%1/%2").arg(outputDirectory, gearView->getLoadedGearPath())); + + if (!QDir().exists(info.absolutePath())) + QDir().mkpath(info.absolutePath()); + file.open(QIODevice::WriteOnly); file.write(reinterpret_cast(buffer.data), buffer.size); file.close();