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

Function orders_list_command

plugins/orders.cpp:160–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160static command_result orders_list_command(color_ostream & out)
161{
162 // use listdir_recursive instead of listdir even though orders doesn't
163 // support subdirs so we can identify and ignore subdirs with ".json" names.
164 // also listdir_recursive will alphabetize the list for us.
165 std::map<std::filesystem::path, bool> files;
166 Filesystem::listdir_recursive(ORDERS_DIR, files, 0, false);
167
168 for (auto& it : files) {
169 if (it.second)
170 continue; // skip directories
171 std::filesystem::path name = it.first;
172 if (name.extension() != ".json")
173 continue; // skip non-.json files
174 auto sname = name.stem();
175 out << sname.string() << std::endl;
176 }
177
178 list_library(out);
179
180 return CR_OK;
181}
182
183static bool is_safe_filename(color_ostream & out, const std::string & name)
184{

Callers 1

orders_commandFunction · 0.85

Calls 1

list_libraryFunction · 0.85

Tested by

no test coverage detected