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

Function UseDedicatedCache

src/TexturePack.c:321–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

319
320static cc_bool createdCache, cacheInvalid;
321static cc_bool UseDedicatedCache(cc_string* path, const cc_string* key) {
322 cc_result res;
323 cc_filepath str;
324 Directory_GetCachePath(path);
325 if (!path->length || cacheInvalid) return false;
326
327 String_AppendConst(path, "/texturecache");
328 Platform_EncodePath(&str, path);
329 res = Directory_Create2(&str);
330
331 /* Check if something is deleting the cache directory behind our back */
332 /* (Several users have reported this happening on some Android devices) */
333 if (createdCache && res == 0) {
334 Chat_AddRaw("&cSomething has deleted system managed cache folder");
335 Chat_AddRaw(" &cFalling back to caching to game folder instead..");
336 cacheInvalid = true;
337 }
338 if (res == 0) createdCache = true;
339
340 String_Format1(path, "/%s", key);
341 return !cacheInvalid;
342}
343
344CC_NOINLINE static void MakeCachePath(cc_string* mainPath, cc_string* altPath, const cc_string* url) {
345 cc_string key; char keyBuffer[STRING_INT_CHARS];

Callers 1

MakeCachePathFunction · 0.85

Calls 6

String_AppendConstFunction · 0.85
Chat_AddRawFunction · 0.85
String_Format1Function · 0.85
Directory_GetCachePathFunction · 0.70
Platform_EncodePathFunction · 0.70
Directory_Create2Function · 0.70

Tested by

no test coverage detected