MCPcopy Create free account
hub / github.com/crownengine/crown / console_command_compile

Function console_command_compile

src/resource/data_compiler.cpp:192–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192static void console_command_compile(ConsoleServer &cs, u32 client_id, const char *json, void *user_data)
193{
194 TempAllocator4096 ta;
195 JsonObject obj(ta);
196 DynamicString id(ta);
197 DynamicString data_dir(ta);
198 DynamicString platform(ta);
199 StringStream ss(ta);
200 DataCompiler *dc = (DataCompiler *)user_data;
201
202 sjson::parse(obj, json);
203 sjson::parse_string(id, obj["id"]);
204 sjson::parse_string(data_dir, obj["data_dir"]);
205 sjson::parse_string(platform, obj["platform"]);
206
207 ss << "{";
208 ss << "\"type\":\"compile\",";
209 ss << "\"id\":\"" << id.c_str() << "\",";
210 ss << "\"start\":true";
211 ss << "}";
212 cs.send(client_id, string_stream::c_str(ss));
213
214 bool succ = dc->compile(data_dir.c_str(), platform.c_str());
215
216 array::clear(ss);
217 ss << "{";
218 ss << "\"type\":\"compile\",";
219 ss << "\"id\":\"" << id.c_str() << "\",";
220 ss << "\"success\":" << (succ ? "true" : "false") << ",";
221 ss << "\"revision\":" << dc->_revision;
222 ss << "}";
223
224 cs.send(client_id, string_stream::c_str(ss));
225}
226
227static void console_command_quit(ConsoleServer & /*cs*/, u32 /*client_id*/, const char * /*json*/, void * /*user_data*/)
228{

Callers

nothing calls this directly

Calls 6

sendMethod · 0.80
parseFunction · 0.70
parse_stringFunction · 0.50
clearFunction · 0.50
c_strMethod · 0.45
compileMethod · 0.45

Tested by

no test coverage detected