Bugfix by Vitek to allow zip files inside zip files.
git-svn-id: http://svn.code.sf.net/p/irrlicht/code/trunk@1491 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
add466a67f
commit
42f2529290
@ -41,7 +41,6 @@ CFileSystem::CFileSystem()
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! destructor
|
||||
CFileSystem::~CFileSystem()
|
||||
{
|
||||
@ -58,7 +57,6 @@ CFileSystem::~CFileSystem()
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! opens a file for read access
|
||||
IReadFile* CFileSystem::createAndOpenFile(const c8* filename)
|
||||
{
|
||||
@ -86,10 +84,10 @@ IReadFile* CFileSystem::createAndOpenFile(const c8* filename)
|
||||
return file;
|
||||
}
|
||||
|
||||
file = createReadFile(filename);
|
||||
return file;
|
||||
return createReadFile(filename);
|
||||
}
|
||||
|
||||
|
||||
//! Creates an IReadFile interface for treating memory like a file.
|
||||
IReadFile* CFileSystem::createMemoryReadFile(void* memory, s32 len,
|
||||
const c8* fileName, bool deleteMemoryWhenDropped)
|
||||
@ -100,6 +98,7 @@ IReadFile* CFileSystem::createMemoryReadFile(void* memory, s32 len,
|
||||
return new CMemoryReadFile(memory, len, fileName, deleteMemoryWhenDropped);
|
||||
}
|
||||
|
||||
|
||||
//! Opens a file for write access.
|
||||
IWriteFile* CFileSystem::createAndWriteFile(const c8* filename, bool append)
|
||||
{
|
||||
@ -109,76 +108,64 @@ IWriteFile* CFileSystem::createAndWriteFile(const c8* filename, bool append)
|
||||
|
||||
bool CFileSystem::addFolderFileArchive(const c8* filename, bool ignoreCase, bool ignorePaths)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
CUnZipReader* zr = new CUnZipReader( this, filename, ignoreCase, ignorePaths);
|
||||
CUnZipReader* zr = new CUnZipReader(this, filename, ignoreCase, ignorePaths);
|
||||
if (zr)
|
||||
{
|
||||
UnZipFileSystems.push_back(zr);
|
||||
ret = true;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
if ( false == ret )
|
||||
else
|
||||
{
|
||||
os::Printer::log("Could not open file. UnZipfile not added", filename, ELL_ERROR);
|
||||
os::Printer::log("Could not open file. Folderfile not added", filename, ELL_ERROR);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
|
||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||
return (zr!=0);
|
||||
}
|
||||
|
||||
|
||||
//! adds an zip archive to the filesystem
|
||||
bool CFileSystem::addZipFileArchive(const c8* filename, bool ignoreCase, bool ignorePaths)
|
||||
{
|
||||
IReadFile* file = createReadFile(filename);
|
||||
CZipReader* zr = 0;
|
||||
IReadFile* file = createAndOpenFile(filename);
|
||||
if (file)
|
||||
{
|
||||
CZipReader* zr = new CZipReader(file, ignoreCase, ignorePaths);
|
||||
zr = new CZipReader(file, ignoreCase, ignorePaths);
|
||||
if (zr)
|
||||
ZipFileSystems.push_back(zr);
|
||||
|
||||
file->drop();
|
||||
|
||||
bool ret = (zr != 0);
|
||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
os::Printer::log("Could not open file. Zipfile not added", filename, ELL_ERROR);
|
||||
else
|
||||
os::Printer::log("Could not open file. Zipfile not added", filename, ELL_ERROR);
|
||||
#endif
|
||||
|
||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||
return false;
|
||||
return (zr != 0);
|
||||
}
|
||||
|
||||
|
||||
//! adds an pak archive to the filesystem
|
||||
bool CFileSystem::addPakFileArchive(const c8* filename, bool ignoreCase, bool ignorePaths)
|
||||
{
|
||||
IReadFile* file = createReadFile(filename);
|
||||
CPakReader* zr = 0;
|
||||
IReadFile* file = createAndOpenFile(filename);
|
||||
if (file)
|
||||
{
|
||||
CPakReader* zr = new CPakReader(file, ignoreCase, ignorePaths);
|
||||
zr = new CPakReader(file, ignoreCase, ignorePaths);
|
||||
if (zr)
|
||||
PakFileSystems.push_back(zr);
|
||||
|
||||
file->drop();
|
||||
|
||||
bool ret = (zr != 0);
|
||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
os::Printer::log("Could not open file. Pakfile not added", filename, ELL_ERROR);
|
||||
else
|
||||
os::Printer::log("Could not open file. Pakfile not added", filename, ELL_ERROR);
|
||||
#endif
|
||||
|
||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||
return false;
|
||||
return (zr != 0);
|
||||
}
|
||||
|
||||
|
||||
@ -215,6 +202,7 @@ bool CFileSystem::changeWorkingDirectoryTo(const c8* newDirectory)
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
core::stringc CFileSystem::getAbsolutePath(const core::stringc& filename) const
|
||||
{
|
||||
c8 *p=0;
|
||||
@ -325,6 +313,7 @@ IXMLReader* CFileSystem::createXMLReader(IReadFile* file)
|
||||
return createIXMLReader(file);
|
||||
}
|
||||
|
||||
|
||||
//! Creates a XML Reader from a file.
|
||||
IXMLReaderUTF8* CFileSystem::createXMLReaderUTF8(const c8* filename)
|
||||
{
|
||||
@ -337,6 +326,7 @@ IXMLReaderUTF8* CFileSystem::createXMLReaderUTF8(const c8* filename)
|
||||
return reader;
|
||||
}
|
||||
|
||||
|
||||
//! Creates a XML Reader from a file.
|
||||
IXMLReaderUTF8* CFileSystem::createXMLReaderUTF8(IReadFile* file)
|
||||
{
|
||||
@ -371,12 +361,14 @@ IFileSystem* createFileSystem()
|
||||
return new CFileSystem();
|
||||
}
|
||||
|
||||
|
||||
//! Creates a new empty collection of attributes, usable for serialization and more.
|
||||
IAttributes* CFileSystem::createEmptyAttributes(video::IVideoDriver* driver)
|
||||
{
|
||||
return new CAttributes(driver);
|
||||
}
|
||||
|
||||
|
||||
} // end namespace irr
|
||||
} // end namespace io
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user