Răsfoiți Sursa

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

Hugh 9 ani în urmă
părinte
comite
bfda7375df
1 a modificat fișierele cu 4 adăugiri și 15 ștergeri
  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 {