Browse Source

- more filesystem logging and possible fix for Win
- added missing destructor for loaders
- added missing override kewords
- added unused for now ARCHIVE_ZIP filetype

Ivan Savenko 12 years ago
parent
commit
9f7c89d5e3

+ 5 - 0
lib/filesystem/AdapterLoaders.cpp

@@ -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)

+ 1 - 0
lib/filesystem/AdapterLoaders.h

@@ -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;

+ 1 - 0
lib/filesystem/CArchiveLoader.cpp

@@ -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)

+ 5 - 5
lib/filesystem/CFileInputStream.h

@@ -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:
 	/**

+ 3 - 2
lib/filesystem/CFilesystemLoader.cpp

@@ -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;
 		}

+ 5 - 5
lib/filesystem/CMemoryStream.h

@@ -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. */

+ 2 - 0
lib/filesystem/Filesystem.cpp

@@ -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)

+ 1 - 0
lib/filesystem/Filesystem.h

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

+ 2 - 2
lib/logging/CLogger.cpp

@@ -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