From: Adam Chlipala Date: Sun, 11 Feb 2007 21:14:31 +0000 (+0000) Subject: Switch to using OS.Path in Compiler X-Git-Url: http://git.hcoop.net/bpt/mlt.git/commitdiff_plain/dcc38e493dadda082424e887a1e8f6397a9a5000 Switch to using OS.Path in Compiler --- diff --git a/src/compiler.sml b/src/compiler.sml index 16d66f8..cd03d6c 100644 --- a/src/compiler.sml +++ b/src/compiler.sml @@ -33,48 +33,14 @@ struct flush = fn () => TextIO.flushOut TextIO.stdOut, linewidth = 80} - fun getFname path = - let - fun look i = - if i < 0 then - path - else if String.sub (path, i) = #"/" then - String.extract (path, i+1, NONE) - else - look (i-1) - in - look (size path - 1) - end + val getFname = OS.Path.file - fun removeExt path = - let - val len = size path - - fun look i = - if i >= len then - path - else if String.sub (path, i) = #"." then - String.substring (path, 0, i) - else - look (i+1) - in - look 0 - end + val removeExt = OS.Path.base fun getExt path = - let - val len = size path - - fun look i = - if i >= len then - path - else if String.sub (path, i) = #"." then - String.extract (path, i+1, NONE) - else - look (i+1) - in - look 0 - end + case OS.Path.ext path of + NONE => path + | SOME ext => ext val upperOffset = ord #"A" - ord #"a" fun toUpper ch =