Explorar o código

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

Simon Krajewski %!s(int64=10) %!d(string=hai) anos
pai
achega
1684bf8c10
Modificáronse 2 ficheiros con 8 adicións e 2 borrados
  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 {
 	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) {
 		return switch(k) {
 		case "file": kfile;
 		case "file": kfile;
 		case "dir": kdir;
 		case "dir": kdir;

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

@@ -56,7 +56,10 @@ class FileSystem {
 	}
 	}
 
 
 	static function kind( path : String ) : FileKind {
 	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) {
 		return switch(k) {
 		case "file": kfile;
 		case "file": kfile;
 		case "dir": kdir;
 		case "dir": kdir;