Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/system/Basis/Implementation/OS/os-path-fn.sml
ViewVC logotype

Diff of /sml/trunk/src/system/Basis/Implementation/OS/os-path-fn.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1239, Tue Jun 11 15:26:11 2002 UTC revision 1240, Tue Jun 11 15:35:34 2002 UTC
# Line 233  Line 233 
233                    else raise Path                    else raise Path
234            (* end case *))            (* end case *))
235    
236        local
237            fun fromUnixPath' up = let
238                fun tr "." = P.currentArc
239                  | tr ".." = P.parentArc
240                  | tr arc = arc
241            in
242                case String.fields (fn c => c = #"/") up of
243                    "" :: arcs => { isAbs = true, vol = "", arcs = map tr arcs }
244                  | arcs => { isAbs = false, vol = "", arcs = map tr arcs }
245            end
246    
247            fun toUnixPath' { isAbs, vol = "", arcs } =
248                let fun tr arc =
249                        if arc = P.currentArc then "."
250                        else if arc = P.parentArc then ".."
251                        else if Char.contains arc #"/" then raise Path
252                        else arc
253                in
254                    String.concatWith "/" (if isAbs then "" :: arcs else arcs)
255                end
256              | toUnixPath' _ = raise Path
257        in
258            val fromUnixPath = toString o fromUnixPath'
259            val toUnixPath = toUnixPath' o fromString
260        end
261    end    end
262  end  end
263    

Legend:
Removed from v.1239  
changed lines
  Added in v.1240

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0