| 1029 | } |
| 1030 | |
| 1031 | void DisplayManager_::loadCustomApps() |
| 1032 | { |
| 1033 | File root = LittleFS.open("/CUSTOMAPPS"); |
| 1034 | |
| 1035 | if (!root) |
| 1036 | { |
| 1037 | if (DEBUG_MODE) |
| 1038 | DEBUG_PRINTLN("Failed to open directory"); |
| 1039 | return; |
| 1040 | } |
| 1041 | if (!root.isDirectory()) |
| 1042 | { |
| 1043 | if (DEBUG_MODE) |
| 1044 | DEBUG_PRINTLN("/CUSTOMAPPS is not a directory"); |
| 1045 | return; |
| 1046 | } |
| 1047 | |
| 1048 | File file = root.openNextFile(); |
| 1049 | |
| 1050 | while (file) |
| 1051 | { |
| 1052 | if (file.isDirectory()) |
| 1053 | { |
| 1054 | file = root.openNextFile(); |
| 1055 | continue; |
| 1056 | } |
| 1057 | |
| 1058 | String fileName = file.name(); |
| 1059 | String json = ""; |
| 1060 | while (file.available()) |
| 1061 | { |
| 1062 | json += char(file.read()); |
| 1063 | } |
| 1064 | file.close(); |
| 1065 | |
| 1066 | String name = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.lastIndexOf('.')); // remove path and .json extension |
| 1067 | parseCustomPage(name, json.c_str(), true); |
| 1068 | |
| 1069 | file = root.openNextFile(); |
| 1070 | } |
| 1071 | } |
| 1072 | |
| 1073 | void DisplayManager_::loadNativeApps() |
| 1074 | { |