| 449 | } |
| 450 | |
| 451 | void GlobalSettings::loadFileLists() { |
| 452 | BOXEDWINE_CRITICAL_SECTION; |
| 453 | |
| 454 | GlobalSettings::availableFileSystemVersions.clear(); |
| 455 | GlobalSettings::availableFileSystemDependencies.clear(); |
| 456 | GlobalSettings::demos.clear(); |
| 457 | GlobalSettings::components.clear(); |
| 458 | |
| 459 | for (auto& url : GlobalSettings::fileUrls) { |
| 460 | BString name = Fs::getFileNameFromPath(url); |
| 461 | BString filesConfigPath = GlobalSettings::dataFolderLocation.stringByApppendingPath(name); |
| 462 | pugi::xml_document doc; |
| 463 | pugi::xml_parse_result result = doc.load_file(filesConfigPath.c_str()); |
| 464 | if (!result) { |
| 465 | return; |
| 466 | } |
| 467 | pugi::xml_node node = doc.child("XML"); |
| 468 | for (pugi::xml_node wine : node.children("Wine")) { |
| 469 | BString childName = BString::copy(wine.child("Name").text().as_string()); |
| 470 | BString wineVersion = BString::copy(wine.child("WineVersion").text().as_string()); |
| 471 | BString ver = BString::copy(wine.child("FileVersion").text().as_string()); |
| 472 | BString file = BString::copy(wine.child("FileURL").text().as_string()); |
| 473 | BString file2 = BString::copy(wine.child("FileURL2").text().as_string()); |
| 474 | BString depend = BString::copy(wine.child("Depend").text().as_string()); |
| 475 | int fileSize = wine.child("FileSizeMB").text().as_int(); |
| 476 | |
| 477 | if (childName.length() && ver.length() && file.length()) { |
| 478 | if (wineVersion.length() == 0) { |
| 479 | wineVersion = childName; |
| 480 | } |
| 481 | std::shared_ptr<FileSystemZip> fs = std::make_shared<FileSystemZip>(childName, wineVersion, ver, file, file2, depend, fileSize); |
| 482 | GlobalSettings::availableFileSystemVersions.push_back(fs); |
| 483 | } |
| 484 | else { |
| 485 | break; |
| 486 | } |
| 487 | } |
| 488 | for (pugi::xml_node fs : node.children("FileSystem")) { |
| 489 | BString childName = BString::copy(fs.child("Name").text().as_string()); |
| 490 | BString ver = BString::copy(fs.child("FileVersion").text().as_string()); |
| 491 | BString file = BString::copy(fs.child("FileURL").text().as_string()); |
| 492 | BString file2 = BString::copy(fs.child("FileURL2").text().as_string()); |
| 493 | BString depend = BString::copy(fs.child("Depend").text().as_string()); |
| 494 | int fileSize = fs.child("FileSizeMB").text().as_int(); |
| 495 | |
| 496 | if (childName.length() && ver.length() && file.length()) { |
| 497 | std::shared_ptr<FileSystemZip> fs = std::make_shared<FileSystemZip>(childName, B(""), ver, file, file2, depend, fileSize); |
| 498 | GlobalSettings::availableFileSystemVersions.push_back(fs); |
| 499 | } else { |
| 500 | break; |
| 501 | } |
| 502 | } |
| 503 | for (pugi::xml_node wine : node.children("Dependency")) { |
| 504 | BString childName = BString::copy(wine.child("Name").text().as_string()); |
| 505 | BString ver = BString::copy(wine.child("FileVersion").text().as_string()); |
| 506 | BString file = BString::copy(wine.child("FileURL").text().as_string()); |
| 507 | BString depend = BString::copy(wine.child("Depend").text().as_string()); |
| 508 | int fileSize = wine.child("FileSizeMB").text().as_int(); |
nothing calls this directly
no test coverage detected