| 177 | } |
| 178 | |
| 179 | JSValue 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 | |
| 192 | JSValue native_dialogViewText(JSContext *ctx, JSValue *this_val, int argc, JSValue *argv) { |
| 193 | if (argc < 1 || !JS_IsString(ctx, argv[0])) return JS_UNDEFINED; |
nothing calls this directly
no test coverage detected