From 2cfea598c287a12a9aed2c02dc9114c1d9f57ca7 Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Sat, 31 Aug 2024 16:27:39 +0200 Subject: [PATCH] fixes & simplify --- launcher/modManager/chroniclesextractor.cpp | 15 ++++++++------- launcher/modManager/chroniclesextractor.h | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/launcher/modManager/chroniclesextractor.cpp b/launcher/modManager/chroniclesextractor.cpp index bb4263d52..7f4702689 100644 --- a/launcher/modManager/chroniclesextractor.cpp +++ b/launcher/modManager/chroniclesextractor.cpp @@ -190,13 +190,14 @@ void ChroniclesExtractor::extractFiles(int no) QDir tmpDir = tempDir.filePath(tempDir.entryList({"app"}, QDir::Filter::Dirs).front()); tmpDir.setPath(tmpDir.filePath(tmpDir.entryList({QString(tmpChronicles)}, QDir::Filter::Dirs).front())); tmpDir.setPath(tmpDir.filePath(tmpDir.entryList({"data"}, QDir::Filter::Dirs).front())); - QDir outDirData(pathToQString(VCMIDirs::get().userDataPath() / "Mods" / "chronicles" / "Mods" / ("chronicles_" + std::to_string(no)) / "content" / "Data")); - QDir outDirSprites(pathToQString(VCMIDirs::get().userDataPath() / "Mods" / "chronicles" / "Mods" / ("chronicles_" + std::to_string(no)) / "content" / "Sprites")); - QDir outDirVideo(pathToQString(VCMIDirs::get().userDataPath() / "Mods" / "chronicles" / "Mods" / ("chronicles_" + std::to_string(no)) / "content" / "Video")); - QDir outDirSounds(pathToQString(VCMIDirs::get().userDataPath() / "Mods" / "chronicles" / "Mods" / ("chronicles_" + std::to_string(no)) / "content" / "Sounds")); - QDir outDirMaps(pathToQString(VCMIDirs::get().userDataPath() / "Mods" / "chronicles" / "Mods" / ("chronicles_" + std::to_string(no)) / "content" / "Maps")); + auto basePath = VCMIDirs::get().userDataPath() / "Mods" / "chronicles" / "Mods" / ("chronicles_" + std::to_string(no)) / "content"; + QDir outDirData(pathToQString(basePath / "Data")); + QDir outDirSprites(pathToQString(basePath / "Sprites")); + QDir outDirVideo(pathToQString(basePath / "Video")); + QDir outDirSounds(pathToQString(basePath / "Sounds")); + QDir outDirMaps(pathToQString(basePath / "Maps")); - auto extract = [no](QDir scrDir, QDir dest, QString file, std::vector files = {}){ + auto extract = [](QDir scrDir, QDir dest, QString file, std::vector files = {}){ CArchiveLoader archive("", scrDir.filePath(scrDir.entryList({file}).front()).toStdString(), false); for(auto & entry : archive.getEntries()) if(files.empty()) @@ -269,4 +270,4 @@ void ChroniclesExtractor::installChronicles(QStringList exe) handleTempDir(false); } -} \ No newline at end of file +} diff --git a/launcher/modManager/chroniclesextractor.h b/launcher/modManager/chroniclesextractor.h index 4defb200e..ba35a47bc 100644 --- a/launcher/modManager/chroniclesextractor.h +++ b/launcher/modManager/chroniclesextractor.h @@ -43,4 +43,4 @@ public: void installChronicles(QStringList exe); ChroniclesExtractor(QWidget *p, std::function cb = nullptr); -}; \ No newline at end of file +};