#include <v_lib.h>

vboolean
lfsEnsurePathAbsolute(char *dest,char *src);

void	V_CALL
vfsEnumFilesEx(
	char *vfs_path,
	void (V_CALL *dir_callback)(char *dir_name),
	void (V_CALL *file_callback)(char *file_name),
	vboolean recursive,
	vboolean show_hidden);

void V_CALL dc(char *dir_name)
{
	printf("directory: '%s'\n",dir_name);
}

void V_CALL fc(char *file_name)
{
	vhandle_t in;
	char c;
	printf("file: '%s'\nContents:\n",file_name);
	in = fileOpenRead(file_name);
	if(in)
	{
		while(fileRead(in,&c,1))
			fputc(c,stdout);
		puts("");
		fileClose(in);
	}
	else
		printf("File '%s' can't be opened.\n",file_name);
}

void doit()
{
	fsInit();
	vfsEnumFilesEx(".",dc,fc,true,true);
	fsShutdown();
}

int main(int argc,char *argv[])
{
	logStartConsoleLog();
	logUpperLevel(LOG_TRACE);
	// vfsOpenDir("/haja/1");
	doit();
	memPrintStats();
	return 0;
}

