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 |
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 |