| 68 | void UI::reloadFormsXml() { forms.clear(); } |
| 69 | |
| 70 | std::vector<UString> UI::getFormIDs() |
| 71 | { |
| 72 | auto formPaths = fw().data->fs.enumerateDirectoryRecursive("forms", ".form"); |
| 73 | std::vector<UString> trimmedPaths; |
| 74 | for (auto &name : formPaths) |
| 75 | { |
| 76 | if (name.substr(0, 6) != "forms/") |
| 77 | { |
| 78 | LogWarning("Unexpected form file prefix for \"%s\"", name); |
| 79 | continue; |
| 80 | } |
| 81 | if (!ends_with(name, ".form")) |
| 82 | { |
| 83 | LogWarning("Unexpected extension on form file \"%s\"", name); |
| 84 | continue; |
| 85 | } |
| 86 | else |
| 87 | { |
| 88 | // Remove '.form' suffix and 'forms/' prefix |
| 89 | trimmedPaths.push_back(name.substr(0, name.length() - 5).substr(6)); |
| 90 | } |
| 91 | } |
| 92 | return trimmedPaths; |
| 93 | } |
| 94 | |
| 95 | }; // namespace OpenApoc |
no test coverage detected