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/cm/paths/abspath.sml
ViewVC logotype

Diff of /sml/trunk/src/cm/paths/abspath.sml

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

revision 274, Fri May 14 05:23:02 1999 UTC revision 275, Sat May 15 09:54:52 1999 UTC
# Line 33  Line 33 
33      val exists : t -> bool      val exists : t -> bool
34      val tstamp : t -> TStamp.t      val tstamp : t -> TStamp.t
35      val stabletstamp : t -> TStamp.t      val stabletstamp : t -> TStamp.t
36    
37        (* The open?Out functions automagically create any necessary directories
38         * and announce this activity via their string consumer argument. *)
39        val openTextIn : t -> TextIO.instream
40        val openTextOut : (string -> unit) -> t -> TextIO.outstream
41        val openBinIn : t -> BinIO.instream
42        val openBinOut : (string -> unit) -> t -> BinIO.outstream
43  end  end
44    
45  structure AbsPath :> ABSPATH = struct  structure AbsPath :> ABSPATH = struct
# Line 263  Line 270 
270          end          end
271          val tstamp = tstamp0 TStamp.TSTAMP          val tstamp = tstamp0 TStamp.TSTAMP
272          val stabletstamp = tstamp0 TStamp.STABLETSTAMP          val stabletstamp = tstamp0 TStamp.STABLETSTAMP
273    
274            fun openOut fileopener (say: string -> unit) ap = let
275                val p = name ap
276                fun generic (maker, pmaker, p) =
277                    maker p
278                    handle exn => let
279                        val { dir, ... } = P.splitDirFile p
280                    in
281                        if dir = "" orelse fileExists dir then raise exn
282                        else (pmaker dir; maker p)
283                    end
284                fun makedirs dir = generic (F.mkDir, makedirs, dir)
285                fun advertisemakedirs dir =
286                    (say (concat ["[creating directory ", dir, " ...]\n"]);
287                     makedirs dir)
288            in
289                generic (fileopener, advertisemakedirs, p)
290            end
291    
292            val openTextIn = TextIO.openIn o name
293            val openBinIn = BinIO.openIn o name
294            val openTextOut = openOut TextIO.openOut
295            val openBinOut = openOut BinIO.openOut
296      end      end
297  end  end

Legend:
Removed from v.274  
changed lines
  Added in v.275

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