* Normalises both the given path and the stored paths and finds the first match. */
| 42 | * Normalises both the given path and the stored paths and finds the first match. |
| 43 | */ |
| 44 | std::optional<size_t> IZipArchive::GetIndexFromPath(std::string_view path) const |
| 45 | { |
| 46 | auto normalisedPath = NormalisePath(path); |
| 47 | if (!normalisedPath.empty()) |
| 48 | { |
| 49 | auto numFiles = GetNumFiles(); |
| 50 | for (size_t i = 0; i < numFiles; i++) |
| 51 | { |
| 52 | auto normalisedZipPath = NormalisePath(GetFileName(i)); |
| 53 | if (normalisedZipPath == normalisedPath) |
| 54 | { |
| 55 | return i; |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | return std::nullopt; |
| 60 | } |
| 61 | |
| 62 | bool IZipArchive::Exists(std::string_view path) const |
| 63 | { |
no test coverage detected