Export app json files indented with tabs.

This commit is contained in:
Cory McWilliams 2024-02-24 10:55:09 -05:00
parent dbf5c7b832
commit 8cf2837725
8 changed files with 20 additions and 18 deletions

View File

@ -171,7 +171,9 @@ void tf_ssb_export(tf_ssb_t* ssb, const char* key)
JS_DeleteProperty(context, app, files_atom, 0); JS_DeleteProperty(context, app, files_atom, 0);
JS_FreeAtom(context, files_atom); JS_FreeAtom(context, files_atom);
JSValue json = JS_JSONStringify(context, app, JS_NULL, JS_NewInt32(context, 2)); JSValue tab = JS_NewString(context, "\t");
JSValue json = JS_JSONStringify(context, app, JS_NULL, tab);
JS_FreeValue(context, tab);
size_t length = 0; size_t length = 0;
const char* string = JS_ToCStringLen(context, &length, json); const char* string = JS_ToCStringLen(context, &length, json);
snprintf(file_path, sizeof(file_path), "apps/%s.json", path); snprintf(file_path, sizeof(file_path), "apps/%s.json", path);