diff --git a/apps/db.json b/apps/db.json index 9dbdad9c..f3ed581e 100644 --- a/apps/db.json +++ b/apps/db.json @@ -1,4 +1,4 @@ { "type": "tildefriends-app", "emoji": "💽" -} \ No newline at end of file +} diff --git a/src/ssb.export.c b/src/ssb.export.c index 2d7a2c87..8dd6f6f3 100644 --- a/src/ssb.export.c +++ b/src/ssb.export.c @@ -11,12 +11,16 @@ #include #include -static void _write_file(const char* path, const void* blob, size_t size) +static void _write_file(const char* path, const void* blob, size_t size, bool force_add_trailing_newline) { FILE* file = fopen(path, "wb"); if (file) { fwrite(blob, 1, size, file); + if (force_add_trailing_newline) + { + fputc('\n', file); + } fclose(file); } else @@ -147,7 +151,7 @@ void tf_ssb_export(tf_ssb_t* ssb, const char* key) if (tf_ssb_db_blob_get(ssb, blob_id, &file_blob, &file_size)) { snprintf(file_path, sizeof(file_path), "apps/%s/%s", path, file_name); - _write_file(file_path, file_blob, file_size); + _write_file(file_path, file_blob, file_size, false); tf_free(file_blob); } @@ -177,7 +181,7 @@ void tf_ssb_export(tf_ssb_t* ssb, const char* key) size_t length = 0; const char* string = JS_ToCStringLen(context, &length, json); snprintf(file_path, sizeof(file_path), "apps/%s.json", path); - _write_file(file_path, string, length); + _write_file(file_path, string, length, true); JS_FreeCString(context, string); JS_FreeValue(context, json);