Bladeren bron

remove trailing slashes on FileSystem.kind

Simon Krajewski 11 jaren geleden
bovenliggende
commit
7287e218ae
3 gewijzigde bestanden met toevoegingen van 4 en 2 verwijderingen
  1. 1 1
      std/cpp/_std/sys/FileSystem.hx
  2. 1 1
      std/neko/_std/sys/FileSystem.hx
  3. 2 0
      tests/unit/unitstd/sys/FileSystem.unit.hx

+ 1 - 1
std/cpp/_std/sys/FileSystem.hx

@@ -54,7 +54,7 @@ class FileSystem {
 	}
 
 	static function kind( path : String ) : FileKind {
-		var k:String = sys_file_type(path);
+		var k:String = sys_file_type(haxe.io.Path.removeTrailingSlashes(path));
 		return switch(k) {
 		case "file": kfile;
 		case "dir": kdir;

+ 1 - 1
std/neko/_std/sys/FileSystem.hx

@@ -51,7 +51,7 @@ class FileSystem {
 	}
 
 	static function kind( path : String ) : FileKind {
-		var k = new String(sys_file_type(untyped path.__s));
+		var k = new String(sys_file_type(untyped (haxe.io.Path.removeTrailingSlashes(path)).__s));
 		return switch(k) {
 		case "file": kfile;
 		case "dir": kdir;

+ 2 - 0
tests/unit/unitstd/sys/FileSystem.unit.hx

@@ -1,4 +1,6 @@
 #if sys
 sys.FileSystem.exists("unitstd") == true;
 sys.FileSystem.exists("unitstd/") == true;
+sys.FileSystem.isDirectory("unitstd") == true;
+sys.FileSystem.isDirectory("unitstd/") == true;
 #end