浏览代码

[cpp] Do not use private enum for FileKind. Closes #5043

Hugh 9 年之前
父节点
当前提交
bfda7375df
共有 1 个文件被更改,包括 4 次插入15 次删除
  1. 4 15
      std/cpp/_std/sys/FileSystem.hx

+ 4 - 15
std/cpp/_std/sys/FileSystem.hx

@@ -23,12 +23,6 @@ package sys;
 
 import cpp.NativeSys;
 
-private enum FileKind {
-	kdir;
-	kfile;
-	kother( k : String );
-}
-
 @:buildXml('<include name="${HXCPP}/src/hx/libs/std/Build.xml"/>')
 @:coreApi
 class FileSystem {
@@ -60,17 +54,12 @@ class FileSystem {
 		return haxe.io.Path.join([Sys.getCwd(), relPath]);
 	}
 
-	static function kind( path : String ) : FileKind {
-		var k:String = NativeSys.sys_file_type(makeCompatiblePath(path));
-		return switch(k) {
-		case "file": kfile;
-		case "dir": kdir;
-		default: kother(k);
-		}
+	inline static function kind( path : String ) : String {
+		return  NativeSys.sys_file_type(makeCompatiblePath(path));
 	}
 
-	public static inline function isDirectory( path : String ) : Bool {
-		return kind(path) == kdir;
+	public static function isDirectory( path : String ) : Bool {
+		return kind(path) == "dir";
 	}
 
 	public static function createDirectory( path : String ) : Void {