Attempts to open the cached data stream for the given url */
| 373 | |
| 374 | /* Attempts to open the cached data stream for the given url */ |
| 375 | static cc_bool OpenCachedData(const cc_string* url, struct Stream* stream) { |
| 376 | cc_string mainPath; char mainBuffer[FILENAME_SIZE]; |
| 377 | cc_string altPath; char altBuffer[FILENAME_SIZE]; |
| 378 | cc_filepath raw_path; |
| 379 | cc_result res; |
| 380 | |
| 381 | String_InitArray(mainPath, mainBuffer); |
| 382 | String_InitArray(altPath, altBuffer); |
| 383 | |
| 384 | |
| 385 | MakeCachePath(&mainPath, &altPath, url); |
| 386 | Platform_EncodePath(&raw_path, &mainPath); |
| 387 | res = Stream_OpenPath(stream, &raw_path); |
| 388 | |
| 389 | /* try fallback cache if can't find in main cache */ |
| 390 | if (res == ReturnCode_FileNotFound && altPath.length) { |
| 391 | Platform_EncodePath(&raw_path, &altPath); |
| 392 | res = Stream_OpenPath(stream, &raw_path); |
| 393 | } |
| 394 | |
| 395 | if (res == ReturnCode_FileNotFound) return false; |
| 396 | if (res) { Logger_SysWarn2(res, "opening cache for", url); return false; } |
| 397 | return true; |
| 398 | } |
| 399 | |
| 400 | CC_NOINLINE static cc_string GetCachedTag(const cc_string* url, struct StringsBuffer* list) { |
| 401 | cc_string key; char keyBuffer[STRING_INT_CHARS]; |
no test coverage detected