Browse Source

addded delete

ncannasse 10 years ago
parent
commit
e3a2bdf422
1 changed files with 13 additions and 0 deletions
  1. 13 0
      hxd/File.hx

+ 13 - 0
hxd/File.hx

@@ -156,6 +156,19 @@ class File {
 		#end
 	}
 
+	public static function delete( path : String ) {
+		#if air3
+		try {
+			getRelPath(path).deleteFile();
+		} catch( e : Dynamic ) {
+		}
+		#elseif sys
+		try sys.FileSystem.deleteFile(path) catch( e : Dynamic ) { };
+		#else
+		throw "Not supported";
+		#end
+	}
+
 	public static function getBytes( path : String ) : haxe.io.Bytes {
 		#if air3
 		var file = getRelPath(path);