| 319 | |
| 320 | static cc_bool createdCache, cacheInvalid; |
| 321 | static 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 | |
| 344 | CC_NOINLINE static void MakeCachePath(cc_string* mainPath, cc_string* altPath, const cc_string* url) { |
| 345 | cc_string key; char keyBuffer[STRING_INT_CHARS]; |
no test coverage detected