fix: not loading iwds from search-path in Unlinker

This commit is contained in:
Jan 2025-01-15 17:47:33 +00:00
parent 64bac44e63
commit a41d15d43a
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C

View File

@ -25,6 +25,23 @@ bool UnlinkerPaths::LoadUserPaths(const UnlinkerArgs& args)
auto searchPathName = absolutePath.string(); auto searchPathName = absolutePath.string();
m_user_paths.CommitSearchPath(std::make_unique<SearchPathFilesystem>(searchPathName)); m_user_paths.CommitSearchPath(std::make_unique<SearchPathFilesystem>(searchPathName));
m_specified_user_paths.emplace(std::move(searchPathName)); m_specified_user_paths.emplace(std::move(searchPathName));
std::filesystem::directory_iterator iterator(absolutePath);
const auto end = fs::end(iterator);
for (auto i = fs::begin(iterator); i != end; ++i)
{
if (!i->is_regular_file())
continue;
auto extension = i->path().extension().string();
utils::MakeStringLowerCase(extension);
if (extension == ".iwd")
{
auto iwd = iwd::LoadFromFile(i->path().string());
if (iwd)
m_user_paths.CommitSearchPath(std::move(iwd));
}
}
} }
std::cout << std::format("{} SearchPaths{}\n", m_specified_user_paths.size(), !m_specified_user_paths.empty() ? ":" : ""); std::cout << std::format("{} SearchPaths{}\n", m_specified_user_paths.size(), !m_specified_user_paths.empty() ? ":" : "");