Commit 3f924718 authored by hybrid's avatar hybrid

Fix eol-style for all code files to CRLF for simpler file handling.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2526 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 3ef1b183
#include "irrlicht.h" #include "irrlicht.h"
#include "testUtils.h" #include "testUtils.h"
using namespace irr; using namespace irr;
using namespace core; using namespace core;
using namespace io; using namespace io;
bool filesystem(void) bool filesystem(void)
{ {
IrrlichtDevice * device = irr::createDevice(video::EDT_NULL, dimension2d<u32>(1, 1)); IrrlichtDevice * device = irr::createDevice(video::EDT_NULL, dimension2d<u32>(1, 1));
assert(device); assert(device);
if(!device) if(!device)
return false; return false;
io::IFileSystem * fs = device->getFileSystem (); io::IFileSystem * fs = device->getFileSystem ();
if ( !fs ) if ( !fs )
return false; return false;
bool result = true; bool result = true;
core::string<c16> workingDir = device->getFileSystem()->getWorkingDirectory(); core::string<c16> workingDir = device->getFileSystem()->getWorkingDirectory();
core::string<c16> empty; core::string<c16> empty;
if ( fs->existFile(empty) ) if ( fs->existFile(empty) )
{ {
logTestString("Empty filename should not exist.\n"); logTestString("Empty filename should not exist.\n");
result = false; result = false;
} }
stringc newWd = workingDir + "/media"; stringc newWd = workingDir + "/media";
bool changed = device->getFileSystem()->changeWorkingDirectoryTo(newWd); bool changed = device->getFileSystem()->changeWorkingDirectoryTo(newWd);
assert(changed); assert(changed);
if ( fs->existFile(empty) ) if ( fs->existFile(empty) )
{ {
logTestString("Empty filename should not exist even in another workingdirectory.\n"); logTestString("Empty filename should not exist even in another workingdirectory.\n");
result = false; result = false;
} }
// The working directory must be restored for the other tests to work. // The working directory must be restored for the other tests to work.
changed = device->getFileSystem()->changeWorkingDirectoryTo(workingDir.c_str()); changed = device->getFileSystem()->changeWorkingDirectoryTo(workingDir.c_str());
assert(changed); assert(changed);
// adding a folder archive which just should not really change anything // adding a folder archive which just should not really change anything
device->getFileSystem()->addFolderFileArchive( "./" ); device->getFileSystem()->addFolderFileArchive( "./" );
if ( fs->existFile(empty) ) if ( fs->existFile(empty) )
{ {
logTestString("Empty filename should not exist in folder file archive.\n"); logTestString("Empty filename should not exist in folder file archive.\n");
result = false; result = false;
} }
// remove it again to not affect other tests // remove it again to not affect other tests
device->getFileSystem()->unregisterFileArchive( device->getFileSystem()->getFileArchiveCount() ); device->getFileSystem()->unregisterFileArchive( device->getFileSystem()->getFileArchiveCount() );
return result; return result;
} }
#include "irrlicht.h" #include "irrlicht.h"
#include "testUtils.h" #include "testUtils.h"
using namespace irr; using namespace irr;
using namespace core; using namespace core;
using namespace io; using namespace io;
bool zipReader(void) bool zipReader(void)
{ {
IrrlichtDevice * device = irr::createDevice(video::EDT_NULL, dimension2d<u32>(1, 1)); IrrlichtDevice * device = irr::createDevice(video::EDT_NULL, dimension2d<u32>(1, 1));
assert(device); assert(device);
if(!device) if(!device)
return false; return false;
io::IFileSystem * fs = device->getFileSystem (); io::IFileSystem * fs = device->getFileSystem ();
if ( !fs ) if ( !fs )
return false; return false;
if ( !fs->registerFileArchive(core::string<c16>("media/file_with_path.zip"), /*bool ignoreCase=*/true, /*bool ignorePaths=*/false) ) if ( !fs->registerFileArchive(core::string<c16>("media/file_with_path.zip"), /*bool ignoreCase=*/true, /*bool ignorePaths=*/false) )
return false; return false;
// log what we got // log what we got
io::IFileArchive* archive = fs->getFileArchive(fs->getFileArchiveCount()-1); io::IFileArchive* archive = fs->getFileArchive(fs->getFileArchiveCount()-1);
for ( u32 f=0; f < archive->getFileCount(); ++f) for ( u32 f=0; f < archive->getFileCount(); ++f)
{ {
const io::IFileArchiveEntry* entry = archive->getFileInfo(f); const io::IFileArchiveEntry* entry = archive->getFileInfo(f);
logTestString("simpleFileName: %s\n", entry->simpleFileName.c_str()); logTestString("simpleFileName: %s\n", entry->simpleFileName.c_str());
logTestString("path: %s\n", entry->path.c_str()); logTestString("path: %s\n", entry->path.c_str());
} }
bool result = true; bool result = true;
core::string<c16> filename("mypath/myfile.txt"); core::string<c16> filename("mypath/myfile.txt");
result &= fs->existFile(filename); result &= fs->existFile(filename);
if (!result ) if (!result )
{ {
logTestString("existFile failed"); logTestString("existFile failed");
} }
IReadFile* readFile = fs->createAndOpenFile(filename); IReadFile* readFile = fs->createAndOpenFile(filename);
if ( !readFile ) if ( !readFile )
{ {
result = false; result = false;
logTestString("createAndOpenFilefailed"); logTestString("createAndOpenFilefailed");
} }
return result; return result;
} }
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