#include <../source/TAL/objbase.h>
#include <../source/vfs/iobase.h>
#include <../source/vfs/fbase.h>
#include <../source/vfs/fsbase.h>
#include <../source/vfs/mbase.h>

void	V_CALL
vfsDumpTree(FILE *out);

void	V_CALL vfs_to_lfs(char *name)
{
	file_t in,out;
	void_p in_base;
	in=vfsCreateFile(name);
	out=lfsCreateFile(name,filemode_write);
	fileControl(in,pctl_map_ispace,&in_base);
	fileWrite(out,in_base,fileSize(in));
	fileClose(in);
	fileClose(out);
	printf("wrote '%s'...\n",name);
}

void 	V_CALL print_dir(char *name)
{
	printf("DIR:  [%s]\n",name);
}

void 	V_CALL print_file(char *name)
{
	printf("FILE: [%s]\n",name);
}

int main()
{
	logStartConsoleLog();
	logUpperLevel(LOG_WARNING);
	fsInit();
	
	vfsEnumFiles(".",print_dir,vfs_to_lfs,true);
	/*
	vfsEnumFiles("maps",print_dir,vfs_to_lfs,true);
	vfsEnumFiles(".",print_dir,print_file,true);
	*/
	vfsShutdown();
	return 0;
}
