class Oxygen.FileSystem inherits FileSystem {
	fixed native string readSync(string location, string format)
	{return "return require('fs').readFileSync(" + context.arguments[0] + ", " + context.arguments[1] + ")";}

	fixed native void read(string location, string format, <void, Error, string>function callback)
	{return "require('fs').readFile(" + context.arguments[0] + ", " + context.arguments[1] + ", " + context.arguments[2] + ")";}

	trust fixed native void write(string location, string content, <void, Error>function callback)
	{return "require('fs').writeFile(" + context.arguments[0] + ", " + context.arguments[1] + ", " + context.arguments[2] + ")";}

	trust fixed native Error writeSync(string location, string content)
	{return "return require('fs').writeFileSync(" + context.arguments[0] + ", " + context.arguments[1] + ")";}

	fixed native FileSystem.Stat statSync(string location)
	{return "return Oxygen.FileSystem.Stat.fromMap(require('fs').statSync(" + context.arguments[0] + "))";}

	void stat(string location, <void, Error, FileSystem.Stat>function callback) {

	}

	FileSystem.File openSync(string location, string flags) {

	}

	void open(string location, string flags, <void, Error, FileSystem.File>function callback) {

	}

	fixed native <string>array readDirSync(string location)
	{return "return require('fs').readdirSync(" + context.arguments[0] + ");";}

	fixed native string dirName(string location)
	{return "return require('path').dirname(" + context.arguments[0] + ");";}

	fixed native string normalize(string path)
	{return "return require('path').normalize(" + context.arguments[0] + ");";}

	fixed native string resolve(string path)
	{return "return require('path').resolve(" + context.arguments[0] + ");";}

	fixed native bool isDir(string location)
	{return "const _fs = require('fs'); return _fs.lstatSync(_fs.realpathSync(" + context.arguments[0] + ")).isDirectory();";}

	fixed native bool exists(string location)
	{return "return require('fs').existsSync(" + context.arguments[0] + ")";}

	fixed native string basename(string location)
	{return "return require('path').basename(" + context.arguments[0] + ")";}

	fixed native void makeDir(string location)
	{return "require('fs').mkdirSync(" + context.arguments[0] + ")";}
	
	fixed native void unlink(string path)
	{return "require('fs').unlinkSync(" + context.arguments[0] + ")";}
}


Oxygen.FileSystem implements FileSystem;