
extern "C" 
{

//------------------------------------------------------------------------------------
// irr::io::IFileList wrappers
// be sure to call the del function when done
//------------------------------------------------------------------------------------

void IrrIO_IFileList_del(IFileList* fl)
{
	if (fl)
		fl->drop();
}

u32 IrrIO_IFileList_getFileCount(IFileList* fl)
{
	if (fl)
		return fl->getFileCount();
	else return 0;
}

const c8* IrrIO_IFileList_getFileName(IFileList* fl,u32 idx)
{
	if (fl)
		return fl->getFileName(idx).c_str();
	else
		return "";
}

const c8* IrrIO_IFileList_getFullFileName(IFileList* fl,u32 idx)
{
	if (fl)
		return fl->getFullFileName(idx).c_str();
	else
		return "";
}

bool IrrIO_IFileList_isDirectory(IFileList* fl,u32 idx)
{
	if (fl)
		return fl->isDirectory(idx);
	else
		return false;
}

bool IrrIO_IFileList_drop(IFileList* unk)
{
	if (unk)
		return unk->drop();
	else return 0;
}

const c8* IrrIO_IFileList_getDebugName(IFileList* unk)
{
	if (unk)
		return unk->getDebugName();
	else return "";
}

void IrrIO_IFileList_grab(IFileList* unk)
{
	if (unk)
		unk->grab();
}

s32 IrrIO_IFileList_findFile(IFileList* fl, const c8* filename, bool isFolder=false) 
{
	if (fl)
		return fl->findFile(path(filename), isFolder);
	else return -1;
}

const c8* IrrIO_IFileList_getPath(IFileList* fl) 
{
	if (fl)
		return fl->getPath().c_str();
	else return "";
}

s32 IrrIO_IFileList_getID(IFileList* fl, u32 index) 
{
	if (fl)
		return fl->getID(index);
	else return -1;
}

s32 IrrIO_IFileList_addItem(IFileList* fl, const c8* fullPath, u32 size, bool isDirectory, u32 id=0)
{
	if (fl)
		return fl->addItem(path(fullPath), size, isDirectory, id);
	else return -1;
}

void IrrIO_IFileList_sort(IFileList* fl)
{
	if (fl)
		fl->sort();
}


}

