1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

- more filesystem logging and possible fix for Win

- added missing destructor for loaders
- added missing override kewords
- added unused for now ARCHIVE_ZIP filetype
This commit is contained in:
Ivan Savenko
2013-07-29 10:08:02 +00:00
parent a314a81fd5
commit 9f7c89d5e3
9 changed files with 25 additions and 14 deletions

View File

@@ -48,6 +48,11 @@ CFilesystemList::CFilesystemList()
loaders = new std::vector<std::unique_ptr<ISimpleResourceLoader> >;
}
CFilesystemList::~CFilesystemList()
{
delete loaders;
}
std::unique_ptr<CInputStream> CFilesystemList::load(const ResourceID & resourceName) const
{
// load resource from last loader that have it (last overriden version)

View File

@@ -59,6 +59,7 @@ class DLL_LINKAGE CFilesystemList : public ISimpleResourceLoader
public:
CFilesystemList();
~CFilesystemList();
/// Interface implementation
/// @see ISimpleResourceLoader
std::unique_ptr<CInputStream> load(const ResourceID & resourceName) const override;

View File

@@ -46,6 +46,7 @@ CArchiveLoader::CArchiveLoader(const std::string &mountPoint, const std::string
{
throw std::runtime_error("LOD archive format unknown. Cannot deal with " + archive);
}
logGlobal->traceStream() << "Archive loaded, " << entries.size() << " files found";
}
void CArchiveLoader::initLODArchive(const std::string &mountPoint, CFileInputStream & fileStream)

View File

@@ -46,7 +46,7 @@ public:
* @param size The number of bytes to read.
* @return the number of bytes read actually.
*/
si64 read(ui8 * data, si64 size);
si64 read(ui8 * data, si64 size) override;
/**
* Seeks the internal read pointer to the specified position.
@@ -54,14 +54,14 @@ public:
* @param position The read position from the beginning.
* @return the position actually moved to, -1 on error.
*/
si64 seek(si64 position);
si64 seek(si64 position) override;
/**
* Gets the current read position in the stream.
*
* @return the read position. -1 on failure or if the read pointer isn't in the valid range.
*/
si64 tell();
si64 tell() override;
/**
* Skips delta numbers of bytes.
@@ -69,14 +69,14 @@ public:
* @param delta The count of bytes to skip.
* @return the count of bytes skipped actually.
*/
si64 skip(si64 delta);
si64 skip(si64 delta) override;
/**
* Gets the length in bytes of the stream.
*
* @return the length in bytes of the stream.
*/
si64 getSize();
si64 getSize() override;
private:
/**

View File

@@ -9,6 +9,7 @@ CFilesystemLoader::CFilesystemLoader(const std::string &mountPoint, const std::s
mountPoint(mountPoint),
fileList(listFiles(mountPoint, depth, initial))
{
logGlobal->traceStream() << "Filesystem loaded, " << fileList.size() << " files found";
}
std::unique_ptr<CInputStream> CFilesystemLoader::load(const ResourceID & resourceName) const
@@ -97,8 +98,8 @@ std::unordered_map<ResourceID, std::string> CFilesystemLoader::listFiles(const s
{
path.resize(it.level()+1);
path.back() = it->path().leaf().string();
// don't iterate into directory if depth limit reached OR into hidden directories (like .svn)
it.no_push(depth <= it.level() || it->path().leaf().string()[0] == '.');
// don't iterate into directory if depth limit reached
it.no_push(depth <= it.level());
type = EResType::DIRECTORY;
}

View File

@@ -33,7 +33,7 @@ public:
* @param size The number of bytes to read.
* @return the number of bytes read actually.
*/
si64 read(ui8 * data, si64 size);
si64 read(ui8 * data, si64 size) override;
/**
* Seeks the internal read pointer to the specified position.
@@ -41,14 +41,14 @@ public:
* @param position The read position from the beginning.
* @return the position actually moved to, -1 on error.
*/
si64 seek(si64 position);
si64 seek(si64 position) override;
/**
* Gets the current read position in the stream.
*
* @return the read position.
*/
si64 tell();
si64 tell() override;
/**
* Skips delta numbers of bytes.
@@ -56,14 +56,14 @@ public:
* @param delta The count of bytes to skip.
* @return the count of bytes skipped actually.
*/
si64 skip(si64 delta);
si64 skip(si64 delta) override;
/**
* Gets the length in bytes of the stream.
*
* @return the length in bytes of the stream.
*/
si64 getSize();
si64 getSize() override;
private:
/** A pointer to the data array. */

View File

@@ -97,6 +97,7 @@ EResType::Type EResTypeHelper::getTypeFromExtension(std::string extension)
(".AVI", EResType::VIDEO)
(".MP3", EResType::MUSIC)
(".OGG", EResType::MUSIC)
(".ZIP", EResType::ARCHIVE_ZIP)
(".LOD", EResType::ARCHIVE_LOD)
(".PAC", EResType::ARCHIVE_LOD)
(".VID", EResType::ARCHIVE_VID)
@@ -130,6 +131,7 @@ std::string EResTypeHelper::getEResTypeAsString(EResType::Type type)
MAP_ENUM(VIDEO)
MAP_ENUM(SOUND)
MAP_ENUM(MUSIC)
MAP_ENUM(ARCHIVE_ZIP)
MAP_ENUM(ARCHIVE_LOD)
MAP_ENUM(ARCHIVE_SND)
MAP_ENUM(ARCHIVE_VID)

View File

@@ -51,6 +51,7 @@ namespace EResType
SOUND,
MUSIC,
ARCHIVE_VID,
ARCHIVE_ZIP,
ARCHIVE_SND,
ARCHIVE_LOD,
PALETTE,

View File

@@ -72,7 +72,7 @@ CLogger * CLogger::getLogger(const CLoggerDomain & domain)
logger = new CLogger(domain);
if(domain.isGlobalDomain())
{
logger->setLevel(ELogLevel::INFO);
logger->setLevel(ELogLevel::TRACE);
}
CLogManager::get().addLogger(logger);
return logger;
@@ -88,7 +88,7 @@ CLogger::CLogger(const CLoggerDomain & domain) : domain(domain)
{
if(domain.isGlobalDomain())
{
level = ELogLevel::INFO;
level = ELogLevel::TRACE;
parent = nullptr;
}
else