Mercurial > hg > sonic-visualiser
comparison repoint.sml @ 2293:a3951575def3
Subrepo and Repoint update
author | Chris Cannam |
---|---|
date | Tue, 11 Jun 2019 14:21:00 +0100 |
parents | ecc44dd16172 |
children | 186a452dddd3 |
comparison
equal
deleted
inserted
replaced
2292:f0d6a7fee7a1 | 2293:a3951575def3 |
---|---|
36 shall not be used in advertising or otherwise to promote the sale, | 36 shall not be used in advertising or otherwise to promote the sale, |
37 use or other dealings in this Software without prior written | 37 use or other dealings in this Software without prior written |
38 authorization. | 38 authorization. |
39 *) | 39 *) |
40 | 40 |
41 val repoint_version = "1.1" | 41 val repoint_version = "1.1.1" |
42 | 42 |
43 | 43 |
44 datatype vcs = | 44 datatype vcs = |
45 HG | | 45 HG | |
46 GIT | | 46 GIT | |
277 fun project_completion_path rootpath = | 277 fun project_completion_path rootpath = |
278 project_file_path rootpath (RepointFilenames.project_completion_file) | 278 project_file_path rootpath (RepointFilenames.project_completion_file) |
279 | 279 |
280 fun trim str = | 280 fun trim str = |
281 hd (String.fields (fn x => x = #"\n" orelse x = #"\r") str) | 281 hd (String.fields (fn x => x = #"\n" orelse x = #"\r") str) |
282 | |
283 fun make_canonical path = | |
284 (* SML/NJ doesn't properly handle "/" when splitting paths - | |
285 it should be a path separator even on Windows, but SML/NJ | |
286 treats it as a normal filename character there. So we must | |
287 convert these explicitly *) | |
288 OS.Path.mkCanonical | |
289 (if OS.Path.concat ("a", "b") = "a\\b" | |
290 then String.translate (fn #"/" => "\\" | | |
291 c => Char.toString c) | |
292 path | |
293 else path) | |
282 | 294 |
283 fun file_url path = | 295 fun file_url path = |
284 let val forward_path = | 296 let val forward_path = |
285 String.translate (fn #"\\" => "/" | | 297 String.translate (fn #"\\" => "/" | |
286 c => Char.toString c) | 298 c => Char.toString c) |
425 | OK () => ((OS.FileSys.mkDir path; OK ()) | 437 | OK () => ((OS.FileSys.mkDir path; OK ()) |
426 handle OS.SysErr (e, _) => | 438 handle OS.SysErr (e, _) => |
427 ERROR ("Directory creation failed: " ^ e)) | 439 ERROR ("Directory creation failed: " ^ e)) |
428 | 440 |
429 fun mkpath path = | 441 fun mkpath path = |
430 mkpath' (OS.Path.mkCanonical path) | 442 mkpath' (make_canonical path) |
431 | 443 |
432 fun dir_contents dir = | 444 fun dir_contents dir = |
433 let open OS | 445 let open OS |
434 fun files_from dirstream = | 446 fun files_from dirstream = |
435 case FileSys.readDir dirstream of | 447 case FileSys.readDir dirstream of |
461 (remove path; OK ()) | 473 (remove path; OK ()) |
462 handle SysErr (e, _) => ERROR ("Path removal failed: " ^ e) | 474 handle SysErr (e, _) => ERROR ("Path removal failed: " ^ e) |
463 end | 475 end |
464 | 476 |
465 fun rmpath path = | 477 fun rmpath path = |
466 rmpath' (OS.Path.mkCanonical path) | 478 rmpath' (make_canonical path) |
467 | 479 |
468 fun nonempty_dir_exists path = | 480 fun nonempty_dir_exists path = |
469 let open OS.FileSys | 481 let open OS.FileSys |
470 in | 482 in |
471 (not (isLink path) andalso | 483 (not (isLink path) andalso |