1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-22 00:27:58 +02:00

some work on new filesystem, not tested

- one more new file
- removed duplicating code
- filesystem parser is now recursive
- decompression should be possible if decompressed size is unknown
- autotools and cmake update
This commit is contained in:
Ivan Savenko
2012-07-23 10:23:43 +00:00
parent 4bd8a5a15b
commit a72a294a46
17 changed files with 434 additions and 460 deletions

View File

@@ -9,23 +9,23 @@ CFilesystemLoader::CFilesystemLoader()
}
CFilesystemLoader::CFilesystemLoader(const std::string & baseDirectory)
CFilesystemLoader::CFilesystemLoader(const std::string & baseDirectory, size_t depth)
{
open(baseDirectory);
open(baseDirectory, depth);
}
CFilesystemLoader::CFilesystemLoader(const CFileInfo & baseDirectory)
CFilesystemLoader::CFilesystemLoader(const CFileInfo & baseDirectory, size_t depth)
{
open(baseDirectory);
open(baseDirectory, depth);
}
void CFilesystemLoader::open(const std::string & baseDirectory)
void CFilesystemLoader::open(const std::string & baseDirectory, size_t depth)
{
// Indexes all files in the directory and store them
this->baseDirectory = baseDirectory;
CFileInfo directory(baseDirectory);
std::unique_ptr<std::list<CFileInfo> > fileList = directory.listFiles();
if(fileList == nullptr)
std::unique_ptr<std::list<CFileInfo> > fileList = directory.listFiles(depth);
if(fileList)
{
throw std::runtime_error("Directory " + baseDirectory + " not available.");
}
@@ -33,9 +33,9 @@ void CFilesystemLoader::open(const std::string & baseDirectory)
this->fileList = std::move(*fileList);
}
void CFilesystemLoader::open(const CFileInfo & baseDirectory)
void CFilesystemLoader::open(const CFileInfo & baseDirectory, size_t depth)
{
open(baseDirectory.getName());
open(baseDirectory.getName(), depth);
}
std::unique_ptr<CInputStream> CFilesystemLoader::load(const std::string & resourceName) const