changeset 1338:8c1996489265

Better treatment of relative paths in .urp files
author Adam Chlipala <adam@chlipala.net>
date Tue, 14 Dec 2010 10:21:51 -0500 (2010-12-14)
parents b4b5788b20ea
children 43677a8a20e9
files src/compiler.sml
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/compiler.sml	Tue Dec 14 09:37:23 2010 -0500
+++ b/src/compiler.sml	Tue Dec 14 10:21:51 2010 -0500
@@ -368,6 +368,8 @@
 
             fun pu filename =
                 let
+                    val filename = OS.Path.mkAbsolute {path = filename, relativeTo = OS.FileSys.getDir ()}
+
                     val dir = OS.Path.dir filename
                     fun opener () = TextIO.openIn (OS.Path.joinBaseExt {base = filename, ext = SOME "urp"})
 
@@ -705,7 +707,8 @@
                                                      bigLibs := libify' arg :: !bigLibs
                                   | "path" =>
                                     (case String.fields (fn ch => ch = #"=") arg of
-                                         [n, v] => pathmap := M.insert (!pathmap, n, v)
+                                         [n, v] => ((pathmap := M.insert (!pathmap, n, OS.Path.mkAbsolute {path = v, relativeTo = dir}))
+                                                     handle OS.Path.Path => ErrorMsg.error "Invalid 'path' directory argument")
                                        | _ => ErrorMsg.error "path argument not of the form name=value'")
                                   | "onError" =>
                                     (case String.fields (fn ch => ch = #".") arg of