mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Fix Fallout 4 archive detection
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user