diff repoint.sml @ 2293:a3951575def3

Subrepo and Repoint update
author Chris Cannam
date Tue, 11 Jun 2019 14:21:00 +0100
parents ecc44dd16172
children 186a452dddd3
line wrap: on
line diff
--- a/repoint.sml	Fri May 24 14:42:01 2019 +0100
+++ b/repoint.sml	Tue Jun 11 14:21:00 2019 +0100
@@ -38,7 +38,7 @@
     authorization.
 *)
 
-val repoint_version = "1.1"
+val repoint_version = "1.1.1"
 
 
 datatype vcs =
@@ -279,6 +279,18 @@
 
     fun trim str =
         hd (String.fields (fn x => x = #"\n" orelse x = #"\r") str)
+
+    fun make_canonical path =
+        (* SML/NJ doesn't properly handle "/" when splitting paths -
+           it should be a path separator even on Windows, but SML/NJ
+           treats it as a normal filename character there. So we must
+           convert these explicitly *)
+        OS.Path.mkCanonical
+            (if OS.Path.concat ("a", "b") = "a\\b"
+             then String.translate (fn #"/" => "\\" |
+                                    c => Char.toString c)
+                                   path
+             else path)
             
     fun file_url path =
         let val forward_path = 
@@ -427,7 +439,7 @@
                                       ERROR ("Directory creation failed: " ^ e))
 
     fun mkpath path =
-        mkpath' (OS.Path.mkCanonical path)
+        mkpath' (make_canonical path)
 
     fun dir_contents dir =
         let open OS
@@ -463,7 +475,7 @@
         end
 
     fun rmpath path =
-        rmpath' (OS.Path.mkCanonical path)
+        rmpath' (make_canonical path)
 
     fun nonempty_dir_exists path =
         let open OS.FileSys