MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / getFormIDs

Method getFormIDs

forms/ui.cpp:70–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68void UI::reloadFormsXml() { forms.clear(); }
69
70std::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

Callers 1

FormPreviewMethod · 0.80

Calls 2

ends_withFunction · 0.85

Tested by

no test coverage detected