2009-07-30 01:15:41 -07:00
|
|
|
#include "testUtils.h"
|
|
|
|
|
|
|
|
using namespace irr;
|
|
|
|
using namespace core;
|
|
|
|
using namespace io;
|
|
|
|
|
|
|
|
bool filesystem(void)
|
|
|
|
{
|
|
|
|
IrrlichtDevice * device = irr::createDevice(video::EDT_NULL, dimension2d<u32>(1, 1));
|
|
|
|
assert(device);
|
|
|
|
if(!device)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
io::IFileSystem * fs = device->getFileSystem ();
|
|
|
|
if ( !fs )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
bool result = true;
|
|
|
|
|
2009-08-24 02:12:27 -07:00
|
|
|
io::path workingDir = device->getFileSystem()->getWorkingDirectory();
|
2009-07-30 01:15:41 -07:00
|
|
|
|
2009-08-24 02:12:27 -07:00
|
|
|
io::path empty;
|
2009-07-30 01:15:41 -07:00
|
|
|
if ( fs->existFile(empty) )
|
|
|
|
{
|
|
|
|
logTestString("Empty filename should not exist.\n");
|
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
|
2009-08-24 02:12:27 -07:00
|
|
|
io::path newWd = workingDir + "/media";
|
2009-07-30 01:15:41 -07:00
|
|
|
bool changed = device->getFileSystem()->changeWorkingDirectoryTo(newWd);
|
|
|
|
assert(changed);
|
|
|
|
|
|
|
|
if ( fs->existFile(empty) )
|
|
|
|
{
|
|
|
|
logTestString("Empty filename should not exist even in another workingdirectory.\n");
|
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// The working directory must be restored for the other tests to work.
|
|
|
|
changed = device->getFileSystem()->changeWorkingDirectoryTo(workingDir.c_str());
|
|
|
|
assert(changed);
|
|
|
|
|
|
|
|
// adding a folder archive which just should not really change anything
|
|
|
|
device->getFileSystem()->addFolderFileArchive( "./" );
|
|
|
|
|
|
|
|
if ( fs->existFile(empty) )
|
|
|
|
{
|
|
|
|
logTestString("Empty filename should not exist in folder file archive.\n");
|
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// remove it again to not affect other tests
|
2009-08-15 17:30:19 -07:00
|
|
|
device->getFileSystem()->removeFileArchive( device->getFileSystem()->getFileArchiveCount() );
|
2009-07-30 01:15:41 -07:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|