| 117 | } |
| 118 | } |
| 119 | std::string HashFS::hash(const std::filesystem::path& path, bool useCacheOnly /*= false*/) { |
| 120 | if (file_is_hashable(path)) { |
| 121 | std::map<std::string, std::string>::const_iterator it; |
| 122 | it = localFsHashes.find(path.filename().string()); |
| 123 | if (it != localFsHashes.end()) { |
| 124 | return it->second; |
| 125 | } |
| 126 | } else if (!useCacheOnly) { |
| 127 | std::string theHash; |
| 128 | hashFile(path, theHash); |
| 129 | return theHash; |
| 130 | } |
| 131 | return std::string(); |
| 132 | } |