1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-06 14:45:35 +00:00

Show BA2 files in the launcher

This commit is contained in:
Alexei Kotov 2023-08-15 22:22:28 +03:00
parent 426eae3843
commit 5e5a25f901

View file

@ -40,7 +40,7 @@ namespace
{ {
void contentSubdirs(const QString& path, QStringList& dirs) void contentSubdirs(const QString& path, QStringList& dirs)
{ {
QStringList fileFilter{ "*.esm", "*.esp", "*.omwaddon", "*.bsa", "*.omwscripts" }; QStringList fileFilter{ "*.esm", "*.esp", "*.omwaddon", "*.bsa", "*.ba2", "*.omwscripts" };
QStringList dirFilter{ "bookart", "icons", "meshes", "music", "sound", "textures" }; QStringList dirFilter{ "bookart", "icons", "meshes", "music", "sound", "textures" };
QDir currentDir(path); QDir currentDir(path);
@ -722,13 +722,14 @@ void Launcher::DataFilesPage::addArchive(const QString& name, Qt::CheckState sel
void Launcher::DataFilesPage::addArchivesFromDir(const QString& path) void Launcher::DataFilesPage::addArchivesFromDir(const QString& path)
{ {
QDir dir(path, "*.bsa"); QStringList archiveFilter{ "*.bsa", "*.ba2" };
QDir dir(path);
std::unordered_set<QString> archives; std::unordered_set<QString> archives;
for (int i = 0; i < ui.archiveListWidget->count(); ++i) for (int i = 0; i < ui.archiveListWidget->count(); ++i)
archives.insert(ui.archiveListWidget->item(i)->text()); archives.insert(ui.archiveListWidget->item(i)->text());
for (const auto& fileinfo : dir.entryInfoList()) for (const auto& fileinfo : dir.entryInfoList(archiveFilter))
{ {
const auto absPath = fileinfo.absoluteFilePath(); const auto absPath = fileinfo.absoluteFilePath();
if (Bsa::BSAFile::detectVersion(Files::pathFromQString(absPath)) == Bsa::BSAVER_UNKNOWN) if (Bsa::BSAFile::detectVersion(Files::pathFromQString(absPath)) == Bsa::BSAVER_UNKNOWN)