65 bfs::path filePath(path);
75 if (entryData.
comp == 8) {
76 FL_DBG(
_log,
LMsg(
"trying to uncompress file ") << path <<
" (compressed with method " << entryData.
comp <<
")");
81 zstream.next_in = compdata.get();
83 zstream.zalloc = Z_NULL;
84 zstream.zfree = Z_NULL;
85 zstream.opaque = Z_NULL;
86 zstream.next_out = data;
89 if (inflateInit2(&zstream, -15) != Z_OK) {
95 int32_t err = inflate(&zstream, Z_FINISH);
96 if (err != Z_STREAM_END) {
103 inflateEnd(&zstream);
108 inflateEnd(&zstream);
109 }
else if (entryData.
comp == 0) {
131 if (header == DE_HEADER || header == CF_HEADER) {
146 if (header != LF_HEADER) {
152 FL_ERR(
_log,
LMsg(
"only zip version 2 is supported, required: ") << vneeded);
160 FL_DBG(
_log,
LMsg(
"found file: ") << filePath.string() <<
" (" << compsize <<
"/" << realsize <<
") on offset " << offset);
163 if (gflags & (0x01 << 3)) {
169 if (lmodtime || lmoddate) {}
178 std::string filename = filePath.string();
191 std::set<std::string> result;
193 bfs::path fixedPath(path);
199 ZipNodeContainer::iterator iter;
200 for (iter = files.begin(); iter != files.end(); ++iter) {
201 result.insert((*iter)->getFullName());
210 std::set<std::string> result;
212 bfs::path fixedPath(path);
218 ZipNodeContainer::iterator iter;
219 for (iter = files.begin(); iter != files.end(); ++iter) {
220 result.insert((*iter)->getFullName());
static const uint32_t CF_HEADER
std::vector< ZipNode * > ZipNodeContainer
void moveIndex(int32_t offset)
move the current index
Helper class to create log strings out from separate parts Usage: LMsg("some text") << variable << "...
VFSSource abstract baseclass.
ZipNode * addNode(const std::string &nodePath)
adds a node to the proper place in the tree based on the node path name
ZipSource(VFS *vfs, const std::string &zip_file)
std::set< std::string > listDirectories(const std::string &path) const
list all directories in a directory of this source
static Logger _log(LM_AUDIO)
std::vector< ZipNode * > getChildren(ZipContentType::Enum contentType=ZipContentType::All) const
gives access to retrieve the children of this node
#define FL_ERR(logger, msg)
bool fileExists(const std::string &file) const
WARNING: fileExists, listFiles and listDirectories are not.
uint32_t getCurrentIndex() const
get the current index
const ZipEntryData & getZipEntryData() const
accessor for the entry data associated with this node in the zip archive
virtual RawData * open(const std::string &path) const
open a file inside this source
std::string readString(size_t len)
read a string with len bytes, not assuming a terminating 0 Appends a null terminator character to the...
ZipNode * getNode(const std::string &name) const
accessor for getting a node by name
uint32_t read32Little()
reads a uint16_t littleEndian and converts them to the host-byteorder
void readInto(uint8_t *buffer, size_t len)
read len bytes into buffer
the main VFS (virtual file system) class
void setZipEntryData(const ZipEntryData &entryData)
sets the zip file entry information for this node in the zip archive
uint16_t read16Little()
reads a uint16_t littleEndian and converts them to the host-byteorder
void setIndex(uint32_t index)
set the current index
std::set< std::string > listFiles(const std::string &path) const
list all files in a directory of this source
static const uint32_t DE_HEADER
Create a Logger instance to communicate with LogManager Logger stores information about the current m...
#define FL_DBG(logger, msg)
static const uint32_t LF_HEADER
Used to access diffrent kinds of data.