MCPcopy Create free account
hub / github.com/FastLED/FastLED / fastled_declare_files

Function fastled_declare_files

src/platforms/wasm/fs_wasm.cpp.hpp:319–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319EMSCRIPTEN_KEEPALIVE void fastled_declare_files(const char* jsonStr) {
320 fl::json doc = fl::json::parse(fl::string(jsonStr));
321 if (!doc.is_object() || !doc.contains("files")) {
322 return;
323 }
324
325 auto files = doc["files"];
326 if (!files.is_array()) {
327 return;
328 }
329
330 size_t fileCount = files.size();
331 for (size_t i = 0; i < fileCount; i++) {
332 auto file = files[i];
333 if (!file.is_object()) {
334 continue;
335 }
336
337 if (!file.contains("size") || !file.contains("path")) {
338 continue;
339 }
340
341 int size = file["size"] | 0;
342 fl::string path = file["path"] | fl::string("");
343
344 if (size > 0 && !path.empty()) {
345 fl::printf("Declaring file %s with size %d. These will become available as "
346 "File system paths within the app.\n",
347 path.c_str(), size);
348 jsDeclareFile(path.c_str(), size);
349 }
350 }
351}
352
353} // extern "C"
354

Callers

nothing calls this directly

Calls 9

printfFunction · 0.85
jsDeclareFileFunction · 0.85
stringClass · 0.50
is_objectMethod · 0.45
containsMethod · 0.45
is_arrayMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected