浏览代码

addded delete

ncannasse 10 年之前
父节点
当前提交
e3a2bdf422
共有 1 个文件被更改,包括 13 次插入0 次删除
  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);