浏览代码

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

Simon Krajewski 10 年之前
父节点
当前提交
1684bf8c10
共有 2 个文件被更改,包括 8 次插入2 次删除
  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;