Browse Source

fix (filebrowser): minified filebrowser json file

master
Mario Lukas 5 years ago
parent
commit
52aef3137b
  1. 12
      src/main.cpp

12
src/main.cpp

@ -488,15 +488,15 @@ void appendNodeToJSONFile(fs::FS &fs, const char * path, const char *filename, c
//TODO: write a minified json, without all those whitespaces
// it is just easier to debug when json is in a nice format
// anyway ugly but works and is stable
file.print(F(( " {\n \"id\" : \"")));
file.print(F("{\"id\":\""));
file.print(filename);
file.print(F("\",\n \"parent\" : \""));
file.print(F("\",\"parent\":\""));
file.print(parent);
file.print(F("\",\n \"type\": \""));
file.print(F("\",\"type\":\""));
file.print(type);
file.print(F("\",\n \"text\" : \""));
file.print(F("\",\"text\":\""));
file.print(filename);
file.print(F("\"\n }"));
file.print(F("\"}"));
// i/o is timing critical keep all stuff running
esp_task_wdt_reset();
yield();
@ -598,7 +598,7 @@ void parseSDFileList(fs::FS &fs, const char * dirname, const char * parent, uint
* is done.
*/
void createJSONFileList() {
createFile(SD, DIRECTORY_INDEX_FILE, "[\n");
createFile(SD, DIRECTORY_INDEX_FILE, "[");
parseSDFileList(SD, "/", NULL, FS_DEPTH);
appendToFile(SD, DIRECTORY_INDEX_FILE, "]");
isFirstJSONtNode = true;

Loading…
Cancel
Save