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

Function IsImageCached

src/common/image_source.cpp:141–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141bool IsImageCached(const std::string& images_dir, const ImageEntry& entry) {
142 std::string cache_dir = ImageCacheDir(images_dir, entry);
143 if (!fs::exists(cache_dir) || !fs::is_directory(cache_dir)) {
144 return false;
145 }
146
147 for (const auto& file : entry.files) {
148 fs::path file_path = fs::path(cache_dir) / file.name;
149 if (!fs::exists(file_path)) {
150 return false;
151 }
152 fs::path tmp_path = fs::path(cache_dir) / (file.name + ".tmp");
153 if (fs::exists(tmp_path)) {
154 return false;
155 }
156 }
157 return true;
158}
159
160std::vector<ImageEntry> GetCachedImages(const std::string& images_dir) {
161 std::vector<ImageEntry> result;

Callers 4

GetCachedImagesFunction · 0.85
ImageToJsonFunction · 0.85
StartImageDownloadMethod · 0.85
DlgSubclassProcFunction · 0.85

Calls 1

ImageCacheDirFunction · 0.85

Tested by

no test coverage detected