equal
deleted
inserted
replaced
21 val copy: Path.T -> Path.T -> unit |
21 val copy: Path.T -> Path.T -> unit |
22 eqtype info |
22 eqtype info |
23 val info: Path.T -> info option |
23 val info: Path.T -> info option |
24 val exists: Path.T -> bool |
24 val exists: Path.T -> bool |
25 val mkdir: Path.T -> unit |
25 val mkdir: Path.T -> unit |
26 val source: Path.T -> (string, string list) Source.source * Position.T |
26 val copy_all: Path.T -> Path.T -> unit |
27 val plain_use: Path.T -> unit |
27 val plain_use: Path.T -> unit |
28 val symbol_use: Path.T -> unit |
28 val symbol_use: Path.T -> unit |
29 end; |
29 end; |
30 |
30 |
31 structure File: FILE = |
31 structure File: FILE = |
68 |
68 |
69 fun output txt stream = TextIO.output (stream, txt); |
69 fun output txt stream = TextIO.output (stream, txt); |
70 |
70 |
71 fun read path = fail_safe TextIO.inputAll TextIO.closeIn (TextIO.openIn (sysify_path path)); |
71 fun read path = fail_safe TextIO.inputAll TextIO.closeIn (TextIO.openIn (sysify_path path)); |
72 fun write path txt = fail_safe (output txt) TextIO.closeOut (TextIO.openOut (sysify_path path)); |
72 fun write path txt = fail_safe (output txt) TextIO.closeOut (TextIO.openOut (sysify_path path)); |
73 fun append path txt = fail_safe (output txt) TextIO.closeOut (TextIO.openAppend (sysify_path path)); |
73 fun append path txt = |
|
74 fail_safe (output txt) TextIO.closeOut (TextIO.openAppend (sysify_path path)); |
74 |
75 |
75 fun copy inpath outpath = write outpath (read inpath); |
76 fun copy inpath outpath = write outpath (read inpath); |
76 |
77 |
77 |
78 |
78 (* file info *) |
79 (* file info *) |
87 end; |
88 end; |
88 |
89 |
89 val exists = is_some o info; |
90 val exists = is_some o info; |
90 |
91 |
91 |
92 |
92 (* mkdir *) |
93 (* directories *) |
93 |
94 |
94 fun mkdir path = (execute ("mkdir -p " ^ enclose "'" "'" (sysify_path path)); ()); |
95 val quote_sysify = enclose "'" "'" o sysify_path; |
95 |
96 |
|
97 fun mkdir path = (execute ("mkdir -p " ^ quote_sysify path); ()); |
96 |
98 |
97 (* source *) |
99 fun copy_all path1 path2 = |
98 |
100 (execute ("cp -R " ^ quote_sysify path1 ^ " " ^ quote_sysify path2); ()); |
99 fun source raw_path = |
|
100 let val path = Path.expand raw_path |
|
101 in (Source.of_string (read path), Position.line_name 1 (quote (Path.pack path))) end; |
|
102 |
101 |
103 |
102 |
104 (* symbol_use *) |
103 (* symbol_use *) |
105 |
104 |
106 val plain_use = use o sysify_path; |
105 val plain_use = use o sysify_path; |