From 644879f5feda22aa85bbb45f1f42e8d2a9f8c4a3 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Thu, 31 Mar 2016 19:33:15 +0100 Subject: [PATCH] Fix Fallout 4 archive detection --- src/backend/plugin/plugin.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/backend/plugin/plugin.cpp b/src/backend/plugin/plugin.cpp index bfac994b..ac54106c 100644 --- a/src/backend/plugin/plugin.cpp +++ b/src/backend/plugin/plugin.cpp @@ -92,15 +92,21 @@ namespace loot { _isActive = game.IsPluginActive(Name()); // Get whether the plugin loads an archive (BSA/BA2) or not. + string archiveExtension; + if (game.Id() == Game::fo4) + archiveExtension = ".ba2"; + else + archiveExtension = ".bsa"; + if (game.Id() == Game::tes5 || game.Id() == Game::fo4) { // Skyrim and Fallout 4 plugins only load archives that exactly match their basename. - _loadsArchive = boost::filesystem::exists(game.DataPath() / (Name().substr(0, Name().length() - 3) + "bsa")); + _loadsArchive = boost::filesystem::exists(game.DataPath() / (Name().substr(0, Name().length() - 4) + archiveExtension)); } else if (game.Id() != Game::tes4 || boost::iends_with(Name(), ".esp")) { //Oblivion .esp files and FO3, FNV plugins can load BSAs which begin with the plugin basename. string basename = Name().substr(0, Name().length() - 4); for (boost::filesystem::directory_iterator it(game.DataPath()); it != boost::filesystem::directory_iterator(); ++it) { - if (it->path().extension().string() == ".bsa" && boost::istarts_with(it->path().filename().string(), basename)) { + if (boost::iequals(it->path().extension().string(), archiveExtension) && boost::istarts_with(it->path().filename().string(), basename)) { _loadsArchive = true; break; }