[MLton] cvs commit: OS.Path.joinDirFile does not check argument

Stephen Weeks sweeks@mlton.org
Thu, 3 Feb 2005 10:55:50 -0800


sweeks      05/02/03 10:55:50

  Modified:    doc      changelog
               basis-library/system path.sml
  Log:
  MAIL OS.Path.joinDirFile does not check argument
  
  Fixed a bug in OS.Path.joinDirFile, which did not raise InvalidArc
  when passed a file that was not an arc.  It now dows.

Revision  Changes    Path
1.146     +4 -0      mlton/doc/changelog

Index: changelog
===================================================================
RCS file: /cvsroot/mlton/mlton/doc/changelog,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -r1.145 -r1.146
--- changelog	26 Jan 2005 20:29:48 -0000	1.145
+++ changelog	3 Feb 2005 18:55:50 -0000	1.146
@@ -1,5 +1,9 @@
 Here are the changes since version 20041109.
 
+* 2005-02-03
+  - Fixed a bug in OS.Path.joinDirFile, which did not raise InvalidArc
+    when passed a file that was not an arc.
+
 * 2005-01-26
   - Fixed a front end bug that incorrectly rejected expansive valbinds
     with useless bound type variables.



1.9       +9 -1      mlton/basis-library/system/path.sml

Index: path.sml
===================================================================
RCS file: /cvsroot/mlton/mlton/basis-library/system/path.sml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- path.sml	25 Aug 2004 17:51:07 -0000	1.8
+++ path.sml	3 Feb 2005 18:55:50 -0000	1.9
@@ -192,7 +192,15 @@
 
   fun isCanonical p = mkCanonical p = p;
 
-  fun joinDirFile {dir, file} = concat(dir, file)
+  fun toArcOpt s =
+     case fromString s of
+	{arcs = [a], isAbs = false, vol = ""} => SOME a
+      | _ => NONE
+	
+  fun joinDirFile {dir, file} =
+     case toArcOpt file of
+	NONE => raise InvalidArc
+      | SOME a => concat (dir, a)
 
   fun splitDirFile p =
       let open List