Parcourir la source

[cpp] [neko] do not remove trailing slashes from absolute path (see #3266)

Simon Krajewski il y a 10 ans
Parent
commit
1684bf8c10
2 fichiers modifiés avec 8 ajouts et 2 suppressions
  1. 4 1
      std/cpp/_std/sys/FileSystem.hx
  2. 4 1
      std/neko/_std/sys/FileSystem.hx

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

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

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

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