MCPcopy Create free account
hub / github.com/DFHack/dfhack / list_library

Function list_library

plugins/orders.cpp:136–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136static void list_library(color_ostream &out) {
137 std::map<std::filesystem::path, bool> files;
138 if (0 < Filesystem::listdir_recursive(ORDERS_LIBRARY_DIR, files, 0, false)) {
139 // if the library directory doesn't exist, just skip it
140 return;
141 }
142
143 if (files.empty()) {
144 // if no files in the library directory, just skip it
145 return;
146 }
147
148 for (auto& it : files)
149 {
150 if (it.second)
151 continue; // skip directories
152 std::filesystem::path name = it.first;
153 if (name.extension() != ".json")
154 continue; // skip non-.json files
155 auto sname = name.stem();
156 out << Filesystem::as_string("library" / sname) << std::endl;
157 }
158}
159
160static command_result orders_list_command(color_ostream & out)
161{

Callers 1

orders_list_commandFunction · 0.85

Calls 2

as_stringFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected