MCPcopy Create free account
hub / github.com/BruceDevices/firmware / native_dialogViewFile

Function native_dialogViewFile

src/modules/bjs_interpreter/dialog_js.cpp:179–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179JSValue native_dialogViewFile(JSContext *ctx, JSValue *this_val, int argc, JSValue *argv) {
180 if (argc < 1 || !JS_IsString(ctx, argv[0])) return JS_UNDEFINED;
181 JSCStringBuf sb;
182 const char *path = JS_ToCString(ctx, argv[0], &sb);
183 String filepath = String(path);
184 if (!filepath.startsWith("/")) filepath = "/" + filepath;
185 FS *fs = NULL;
186 if (SD.exists(filepath)) fs = &SD;
187 else if (LittleFS.exists(filepath)) fs = &LittleFS; // ← add "else if" for SD Priority
188 if (fs) { viewFile(*fs, filepath); }
189 return JS_UNDEFINED;
190}
191
192JSValue native_dialogViewText(JSContext *ctx, JSValue *this_val, int argc, JSValue *argv) {
193 if (argc < 1 || !JS_IsString(ctx, argv[0])) return JS_UNDEFINED;

Callers

nothing calls this directly

Calls 1

viewFileFunction · 0.85

Tested by

no test coverage detected