MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / IsCached

Function IsCached

src/TexturePack.c:359–372  ·  view source on GitHub ↗

Returns non-zero if given URL has been cached */

Source from the content-addressed store, hash-verified

357
358/* Returns non-zero if given URL has been cached */
359static int IsCached(const cc_string* url) {
360 cc_string mainPath; char mainBuffer[FILENAME_SIZE];
361 cc_string altPath; char altBuffer[FILENAME_SIZE];
362 cc_filepath mainStr, altStr;
363
364 String_InitArray(mainPath, mainBuffer);
365 String_InitArray(altPath, altBuffer);
366
367 MakeCachePath(&mainPath, &altPath, url);
368 Platform_EncodePath(&mainStr, &mainPath);
369 Platform_EncodePath(&altStr, &altPath);
370
371 return File_Exists(&mainStr) || (altPath.length && File_Exists(&altStr));
372}
373
374/* Attempts to open the cached data stream for the given url */
375static cc_bool OpenCachedData(const cc_string* url, struct Stream* stream) {

Callers 1

DownloadAsyncFunction · 0.85

Calls 3

MakeCachePathFunction · 0.85
Platform_EncodePathFunction · 0.70
File_ExistsFunction · 0.70

Tested by

no test coverage detected