| 336 | } |
| 337 | |
| 338 | void ProgramInformation::getVerboseAddOnsInfo( |
| 339 | std::stringstream& str, |
| 340 | const std::map<std::string, std::string>& mConfig) |
| 341 | { |
| 342 | // Add installed module information: |
| 343 | const auto modDir = fs::path(Application::getUserAppDataDir()) / "Mod"; |
| 344 | std::vector<std::string> addons; |
| 345 | if (fs::exists(modDir) && fs::is_directory(modDir)) { |
| 346 | for (const auto& mod : fs::directory_iterator(modDir)) { |
| 347 | if (!fs::is_directory(mod)) { |
| 348 | continue; // Ignore files, only show directories |
| 349 | } |
| 350 | auto dirName = mod.path().string(); |
| 351 | auto moduleInfo = getModuleInfoString(dirName); |
| 352 | if (!moduleInfo.empty()) { |
| 353 | addons.push_back(std::move(moduleInfo)); |
| 354 | } |
| 355 | } |
| 356 | } |
| 357 | const auto additionalModules = getValueOrEmpty(mConfig, "AdditionalModulePaths"); |
| 358 | |
| 359 | if (!additionalModules.empty()) { |
| 360 | boost::char_separator<char> sep(";"); |
| 361 | boost::tokenizer<boost::char_separator<char>> mods(additionalModules, sep); |
| 362 | for (const auto& mod : mods) { |
| 363 | auto moduleInfo = getModuleInfoString(mod); |
| 364 | if (!moduleInfo.empty()) { |
| 365 | addons.push_back(std::move(moduleInfo)); |
| 366 | } |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | std::sort(addons.begin(), addons.end()); |
| 371 | if (!addons.empty()) { |
| 372 | str << "Installed mods:\n"; |
| 373 | for (const auto& addon : addons) { |
| 374 | str << addon; |
| 375 | } |
| 376 | } |
| 377 | } |