Commit f6662bff authored by hybrid's avatar hybrid

parent 5c67d339
......@@ -156,8 +156,14 @@ public:
//! Removes an archive from the file system.
/** This will close the archive and free any file handles, but will not
close resources which have already been loaded and are now cached, for
example textures and meshes.
\param filename The archive of the given name will be removed
example textures and meshes. Note that a relative filename might be
interpreted differently on each call, depending on the current working
directory. In case you want to remove an archive that was added using
a relative path name, you have to change to the same working directory
again. This means, that the filename given on creation is not an identifier
for the archive, but just a usual filename that is used for locating the
archive to work with.
\param filename The archive pointed to by the name will be removed
\return True on success, false on failure */
virtual bool removeFileArchive(const path& filename) =0;
......
......@@ -4,6 +4,9 @@ using namespace irr;
using namespace core;
using namespace io;
namespace
{
bool testArchive(IFileSystem* fs, const io::path& archiveName)
{
// make sure there is no archive mounted
......@@ -387,6 +390,43 @@ static bool testMountFile(IFileSystem* fs)
return result;
}
bool testAddRemove(IFileSystem* fs, const io::path& archiveName)
{
// make sure there is no archive mounted
if ( fs->getFileArchiveCount() )
{
logTestString("Already mounted archives found\n");
return false;
}
if ( !fs->addFileArchive(archiveName, /*bool ignoreCase=*/true, /*bool ignorePaths=*/false) )
{
logTestString("Mounting archive failed\n");
return false;
}
// make sure there is an archive mounted
if ( !fs->getFileArchiveCount() )
{
logTestString("Mounted archive not in list\n");
return false;
}
if (!fs->removeFileArchive(archiveName))
{
logTestString("Couldn't remove archive.\n");
return false;
}
// make sure there is no archive mounted
if ( fs->getFileArchiveCount() )
return false;
return true;
}
}
bool archiveReader()
{
IrrlichtDevice * device = irr::createDevice(video::EDT_NULL, dimension2d<u32>(1, 1));
......@@ -418,6 +458,8 @@ bool archiveReader()
ret &= testSpecialZip(fs, "media/lzmadata.zip", "tahoma10_.xml", buf);
// logTestString("Testing complex mount file.\n");
// ret &= testMountFile(fs);
logTestString("Testing add/remove with filenames.\n");
testAddRemove(fs, "media/file_with_path.zip");
device->closeDevice();
device->run();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment