ZipFileReader: Save the zip path so we can log it

This commit is contained in:
Henrik Rydgård committed 2024-11-30 02:44:01 +01:00
1 parent 755b062abd
commit ed296e4587
2 files changed
+9 -3

No files matched your search

+1 -1
View File
@@ -44,7 +44,7 @@ ZipFileReader *ZipFileReader::Create(const Path &zipFile, const char *inZipPath,
if (!path.empty() && path.back() != '/') {
path.push_back('/');
}
return new ZipFileReader(zip_file, path);
return new ZipFileReader(zip_file, zipFile, path);
}
ZipFileReader::~ZipFileReader() {
+8 -2
View File
@@ -36,15 +36,21 @@ public:
bool GetFileListing(const char *path, std::vector<File::FileInfo> *listing, const char *filter) override;
bool GetFileInfo(const char *path, File::FileInfo *info) override;
std::string toString() const override {
return inZipPath_;
std::string retval = zipPath_.ToVisualString();
if (!inZipPath_.empty()) {
retval += ": ";
retval += inZipPath_;
}
return retval;
}
private:
ZipFileReader(zip *zip_file, const std::string &inZipPath) : zip_file_(zip_file), inZipPath_(inZipPath) {}
ZipFileReader(zip *zip_file, const Path &zipPath, const std::string &inZipPath) : zip_file_(zip_file), zipPath_(zipPath), inZipPath_(inZipPath) {}
// Path has to be either an empty string, or a string ending with a /.
bool GetZipListings(const std::string &path, std::set<std::string> &files, std::set<std::string> &directories);
zip *zip_file_ = nullptr;
std::mutex lock_;
std::string inZipPath_;
Path zipPath_;
};