28 #include <boost/scoped_array.hpp>
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) {
151 FL_ERR(
_log,
LMsg(
"only zip version 2 is supported, required: ") << vneeded);
159 FL_DBG(
_log,
LMsg(
"found file: ") << filePath.string() <<
" (" << compsize <<
"/" << realsize <<
") on offset " << offset);
162 if (gflags & (0x01 << 3)) {
168 if (lmodtime || lmoddate) {}
177 std::string filename = filePath.string();
190 std::set<std::string> result;
192 bfs::path fixedPath(path);
198 ZipNodeContainer::iterator iter;
199 for (iter = files.begin(); iter != files.end(); ++iter) {
200 result.insert((*iter)->getFullName());
209 std::set<std::string> result;
211 bfs::path fixedPath(path);
217 ZipNodeContainer::iterator iter;
218 for (iter = files.begin(); iter != files.end(); ++iter) {
219 result.insert((*iter)->getFullName());
static const uint32_t CF_HEADER
std::vector< ZipNode * > ZipNodeContainer
void moveIndex(int32_t offset)
move the current index
std::set< std::string > listFiles(const std::string &path) const
list all files in a directory of this source
Helper class to create log strings out from separate parts Usage: LMsg("some text") << variable << "...
bool fileExists(const std::string &file) const
WARNING: fileExists, listFiles and listDirectories are not.
VFSSource abstract baseclass.
std::vector< ZipNode * > getChildren(ZipContentType::Enum contentType=ZipContentType::All) const
gives access to retrieve the children of this node
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)
static Logger _log(LM_AUDIO)
ZipNode * getNode(const std::string &name) const
accessor for getting a node by name
#define FL_ERR(logger, msg)
uint32_t getCurrentIndex() const
get the current index
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...
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
static const uint32_t DE_HEADER
Create a Logger instance to communicate with LogManager Logger stores information about the current m...
std::set< std::string > listDirectories(const std::string &path) const
list all directories in a directory of this source
const ZipEntryData & getZipEntryData() const
accessor for the entry data associated with this node in the zip archive
#define FL_DBG(logger, msg)
static const uint32_t LF_HEADER
Used to access diffrent kinds of data.