From 6286096b574e5dd2b6d80a3884ed43e0db9ee011 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 17 Mar 2025 23:00:36 +0300 Subject: [PATCH] fix ZipFileDevice::list --- src/io/devices/ZipFileDevice.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/io/devices/ZipFileDevice.cpp b/src/io/devices/ZipFileDevice.cpp index 15b8809c..947ef975 100644 --- a/src/io/devices/ZipFileDevice.cpp +++ b/src/io/devices/ZipFileDevice.cpp @@ -173,6 +173,20 @@ ZipFileDevice::ZipFileDevice( entries[entry.fileName] = std::move(entry); } + for (auto& [name, _] : entries) { + io::path path = name; + + while (!(path = path.parent()).pathPart().empty()) { + if (entries.find(path.pathPart()) != entries.end()) { + continue; + } + Entry entry {}; + entry.isDirectory = true; + entries[path.pathPart()] = entry; + } + break; + } + for (auto& [_, entry] : entries) { findBlob(entry); } @@ -243,6 +257,9 @@ bool ZipFileDevice::exists(std::string_view path) { } bool ZipFileDevice::isdir(std::string_view path) { + if (path.empty()) { + return true; + } const auto& found = entries.find(std::string(path)); if (found == entries.end()) { return false;