1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

fixes & simplify

This commit is contained in:
Laserlicht 2024-08-31 16:27:39 +02:00
parent 36914682a5
commit 2cfea598c2
2 changed files with 9 additions and 8 deletions

View File

@ -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<std::string> files = {}){
auto extract = [](QDir scrDir, QDir dest, QString file, std::vector<std::string> 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);
}
}
}

View File

@ -43,4 +43,4 @@ public:
void installChronicles(QStringList exe);
ChroniclesExtractor(QWidget *p, std::function<void(float percent)> cb = nullptr);
};
};