Skip to content

Commit 53695d4

Browse files
author
Mattia Bertorello
committed
Add comments
1 parent ba79e26 commit 53695d4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arduino-core/src/cc/arduino/utils/network/FileDownloaderCache.java

+3
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,10 @@ private static void updateCacheFilesInfo() throws IOException {
173173
if (cachedFiles != null) {
174174
synchronized (cachedFiles) {
175175
ObjectMapper mapper = new ObjectMapper();
176+
// Generate a pretty json
176177
mapper.enable(SerializationFeature.INDENT_OUTPUT);
177178
final ObjectNode objectNode = mapper.createObjectNode();
179+
// Generate a json {"files":[...{files_info}...]}
178180
objectNode.putArray("files").addAll(
179181
cachedFiles.values().stream()
180182
.map((v) -> mapper.convertValue(v, JsonNode.class))
@@ -184,6 +186,7 @@ private static void updateCacheFilesInfo() throws IOException {
184186
if (Files.notExists(cachedFileInfo)) {
185187
Files.createDirectories(cachedFileInfo.getParent());
186188
}
189+
// Write to cache.json
187190
mapper.writeValue(cachedFileInfo.toFile(), objectNode);
188191
}
189192
}

0 commit comments

Comments
 (0)