[MLton] Windows ports and paths

Wesley W. Terpstra wesley@terpstra.ca
Tue, 3 May 2005 00:45:30 +0200


On Mon, May 02, 2005 at 03:23:15PM -0700, Stephen Weeks wrote:
> 
> > > What you wrote doesn't work for dir="C:" and file=""... 
> > > InvalidArc is raised.
> > 
> > Not when I run it.  I get "C:/".

ROFL! When I first read that, I was like, "Eh? How is that possible?"
Then I realized that of course you ran it under linux. :-)
Besides, the correct output is either "C:", "C:.", or "C:./", not "C:/".

(Of course it raises Path, not InvalidArc like I said---my stupid too)

> How about the following?
> 
> fun joinDirFile {dir, file} =
>    let
>       val {arcs, isAbs, vol} = fromString dir
>       val arcs = 
> 	 case (arcs, file) of
> 	    ([], "") => []
> 	  | _ => concatArcs (arcs, [file])
>    in
>       toString {arcs = arcs,
> 		isAbs = isAbs,
> 		vol = vol}
>    end

Looks fine.

I have no opinion about the "a/", "b" -> "a/b" issue.

-- 
Wesley W. Terpstra <wesley@terpstra.ca>