| 477 | } |
| 478 | |
| 479 | bool CaseCache::load_dir(LPCWSTR filepath) |
| 480 | { |
| 481 | |
| 482 | if (!m_con->IsCaseInsensitive()) |
| 483 | return true; |
| 484 | |
| 485 | wstring dir; |
| 486 | |
| 487 | if (!get_dir_and_file_from_path(filepath, &dir, NULL)) { |
| 488 | return false; |
| 489 | } |
| 490 | |
| 491 | wstring case_dir; |
| 492 | |
| 493 | int status = lookup(dir.c_str(), case_dir); |
| 494 | |
| 495 | if (status != CASE_CACHE_MISS && status != CASE_CACHE_FOUND) |
| 496 | return false; |
| 497 | |
| 498 | if (status == CASE_CACHE_MISS) { |
| 499 | if (!load_dir(dir.c_str())) |
| 500 | return false; |
| 501 | |
| 502 | status = lookup(dir.c_str(), case_dir); |
| 503 | } |
| 504 | |
| 505 | if (status != CASE_CACHE_FOUND) |
| 506 | return false; |
| 507 | |
| 508 | wstring enc_dir; |
| 509 | |
| 510 | if (!encrypt_path(m_con, case_dir.c_str(), enc_dir)) { |
| 511 | return false; |
| 512 | } |
| 513 | |
| 514 | // find_files will store results in cache |
| 515 | |
| 516 | if (find_files(m_con, case_dir.c_str(), enc_dir.c_str(), casecache_fill_find_data, NULL, NULL) != 0) { |
| 517 | return false; |
| 518 | } |
| 519 | |
| 520 | return true; |
| 521 | } |
| 522 | |
| 523 | // when a directory is renamed, do a search and replace in the cache |
| 524 |
no test coverage detected