| 100 | } |
| 101 | |
| 102 | bool DirIvCache::check_node_clean(DirIvCacheNode *node, const wstring& path) |
| 103 | { |
| 104 | |
| 105 | if (!m_ttl || (GetTickCount64() - node->m_timestamp < m_ttl)) |
| 106 | return true; |
| 107 | |
| 108 | wstring filepath = path; |
| 109 | |
| 110 | // already normalized with trailing slash |
| 111 | filepath += DIR_IV_NAME; |
| 112 | |
| 113 | HANDLE hFile = CreateFile(&filepath[0], FILE_READ_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, |
| 114 | OPEN_EXISTING, 0, NULL); |
| 115 | |
| 116 | if (hFile == INVALID_HANDLE_VALUE) |
| 117 | return false; |
| 118 | |
| 119 | FILETIME LastWriteTime; |
| 120 | |
| 121 | BOOL bResult = GetFileTime(hFile, NULL, NULL, &LastWriteTime); |
| 122 | |
| 123 | CloseHandle(hFile); |
| 124 | |
| 125 | if (!bResult) |
| 126 | return false; |
| 127 | |
| 128 | bResult = CompareFileTime(&node->m_last_write_time, &LastWriteTime) >= 0; |
| 129 | |
| 130 | if (bResult) { |
| 131 | node->m_timestamp = GetTickCount64(); |
| 132 | return true; |
| 133 | } else { |
| 134 | return false; |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | void DirIvCache::update_lru(DirIvCacheNode *node) |
| 139 | { |
nothing calls this directly
no outgoing calls
no test coverage detected