MCPcopy Create free account
hub / github.com/78/tenbox / LoadImageMeta

Function LoadImageMeta

src/common/image_source.cpp:212–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212bool LoadImageMeta(const std::string& cache_dir, ImageEntry& entry) {
213 fs::path meta_path = fs::path(cache_dir) / "image.json";
214 if (!fs::exists(meta_path)) {
215 return false;
216 }
217
218 std::ifstream ifs(meta_path);
219 if (!ifs) {
220 return false;
221 }
222
223 std::string content((std::istreambuf_iterator<char>(ifs)),
224 std::istreambuf_iterator<char>());
225
226 auto images = ParseImages("{\"images\":[" + content + "]}");
227 if (images.empty()) {
228 return false;
229 }
230
231 entry = std::move(images[0]);
232 return true;
233}
234
235size_t CleanupStaleImageCache(const std::string& images_dir) {
236 std::error_code ec;

Callers 1

GetCachedImagesFunction · 0.85

Calls 1

ParseImagesFunction · 0.85

Tested by

no test coverage detected