core: simplify_path supports Windows style path
authorAlexis Laferrière <alexis.laf@xymus.net>
Fri, 10 Feb 2017 06:32:31 +0000 (22:32 -0800)
committerAlexis Laferrière <alexis.laf@xymus.net>
Sat, 11 Feb 2017 00:36:56 +0000 (19:36 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/core/file.nit

index c78f6d4..baa3403 100644 (file)
@@ -1057,7 +1057,8 @@ redef class String
        # ~~~
        fun simplify_path: String
        do
-               var a = self.split_with("/")
+               var path_sep = if is_windows then "\\" else "/"
+               var a = self.split_with(path_sep)
                var a2 = new Array[String]
                for x in a do
                        if x == "." and not a2.is_empty then continue # skip `././`