Parcourir la source

Minor cleanup in haxe.io.Path.normalize

Dan Korostelev il y a 9 ans
Parent
commit
dec8556d75
1 fichiers modifiés avec 5 ajouts et 8 suppressions
  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();
 	}
 
 	/**