summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2010-12-14 10:21:51 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2010-12-14 10:21:51 -0500
commite11186e907701f52c561bdee1a88333b9582ab59 (patch)
tree1285189a7783fd76b9a5b68764386777f9b133b5
parent1f45469eace715b013c9075be3102b8eaa4e4f9c (diff)
Better treatment of relative paths in .urp files
-rw-r--r--src/compiler.sml5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler.sml b/src/compiler.sml
index 4fa4fcc8..e8da379c 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -368,6 +368,8 @@ fun parseUrp' accLibs fname =
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 @@ fun parseUrp' accLibs fname =
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