41 <<
"loading: " << file
42 <<
" filesize: " <<
m_data->getDataLength());
50 <<
"number of directories " << dircount);
53 if( dircount*16 >
m_data->getDataLength() ) {
54 throw InvalidFormat(
"directory count larger than filesize.");
57 std::list<std::string> dir_names;
58 for (
uint32_t i = 0; i < dircount; ++i) {
63 dir_names.push_back(name);
66 for(std::list<std::string>::iterator i= dir_names.begin(); i!= dir_names.end(); ++i)
73 for (
uint32_t i = 0; i < filecount; ++i) {
87 return m_data->readString(length);
100 type_filelist::const_iterator i =
m_filelist.find(name);
102 throw NotFound(name);
108 return list(pathstr,
false);
112 return list(pathstr,
true);
115 std::set<std::string>
DAT1::list(
const std::string& pathstr,
bool dirs)
const {
116 std::set<std::string>
list;
117 std::string path = pathstr;
120 if (path.find(
"./") == 0) {
124 size_t lastIndex = path.size();
125 if (lastIndex != 0 && path[lastIndex-1] !=
'/') {
129 type_filelist::const_iterator end =
m_filelist.end();
130 for (type_filelist::const_iterator i =
m_filelist.begin(); i != end; ++i) {
131 const std::string& file = i->first;
132 if (file.find(path) == 0) {
133 std::string cleanedfile = file.substr(path.size(), file.size());
134 bool isdir = cleanedfile.find(
'/') != std::string::npos;
137 cleanedfile = cleanedfile.substr(0, cleanedfile.find(
'/'));
138 if (cleanedfile.find(
'/') != cleanedfile.rfind(
'/')) {
145 list.insert(cleanedfile);
std::set< std::string > list(const std::string &pathstr, bool dirs) const
RawData * open(const std::string &file) const
open a file inside this source
Helper class to create log strings out from separate parts Usage: LMsg("some text") << variable << "...
VFSSource abstract baseclass.
bool fileExists(const std::string &name) const
check if the given file exists
static Logger _log(LM_AUDIO)
VFS * getVFS() const
get the VFS this source is associated with.
void loadFileList(const std::string &dirname)
const RawDataDAT1::s_info & getInfo(const std::string &name) const
Get the needed information to unpack and extract a file from the DAT file.
The needed information for the extraction.
std::unique_ptr< RawData > m_data
std::set< std::string > listFiles(const std::string &pathstr) const
list all files in a directory of this source
DAT1(VFS *vfs, const std::string &file)
Constructor Create a VFSSource for a Fallout1 DAT file.
#define FL_LOG(logger, msg)
A subclass of RawDataMemSource, that fills itself with a FALLOUT1 .DAT file entry.
the main VFS (virtual file system) class
std::set< std::string > listDirectories(const std::string &pathstr) const
list all directories in a directory of this source
std::string fixPath(std::string path) const
Used to access diffrent kinds of data.