浏览代码

Minor cleanup in haxe.io.Path.normalize

Dan Korostelev 9 年之前
父节点
当前提交
dec8556d75
共有 1 个文件被更改,包括 5 次插入8 次删除
  1. 5 8
      std/haxe/io/Path.hx

+ 5 - 8
std/haxe/io/Path.hx

@@ -208,11 +208,9 @@ class Path {
 		If `path` is null, the result is unspecified.
 	**/
 	public static function normalize(path : String) : String {
-		var slash = '/';
-		path = path.split("\\").join("/");
-		if( path == null || path == slash ) {
-			return slash;
-		}
+		var slash = "/";
+		path = path.split("\\").join(slash);
+		if (path == slash) return slash;
 
 		var target = [];
 
@@ -235,7 +233,7 @@ class Path {
 				case ":".code:
 					acc.add(":");
 					colon = true;
-				case "/".code if (colon == false):
+				case "/".code if (!colon):
 					slashes = true;
 				case i:
 					colon = false;
@@ -246,8 +244,7 @@ class Path {
 					acc.add(String.fromCharCode(i));
 			}
 		}
-		var result = acc.toString();
-		return result;
+		return acc.toString();
 	}
 
 	/**