SCM Repository
[smlnj] Diff of /sml/trunk/src/cm/paths/abspath.sml
Diff of /sml/trunk/src/cm/paths/abspath.sml
Parent Directory
|
Revision Log
|
Patch
62 |
| compareId (PRESENT _, ABSENT _) = GREATER |
| compareId (PRESENT _, ABSENT _) = GREATER |
63 |
| compareId (ABSENT s, ABSENT s') = String.compare (s, s') |
| compareId (ABSENT s, ABSENT s') = String.compare (s, s') |
64 |
|
|
65 |
fun getId f = (PRESENT (F.fileId f) handle _ => ABSENT f) |
(* To maximize our chances of recognizing eqivalent path names to |
66 |
|
* non-existing files, we use F.fullPath to expand the largest |
67 |
|
* possible prefix of the path. *) |
68 |
|
fun expandPath f = let |
69 |
|
fun loop { dir, file } = |
70 |
|
P.concat (F.fullPath dir, file) |
71 |
|
handle _ => let |
72 |
|
val { dir = dir', file = file' } = P.splitDirFile dir |
73 |
|
in |
74 |
|
loop { dir = dir', file = P.concat (file', file) } |
75 |
|
end |
76 |
|
in |
77 |
|
(* An initial call to splitDirFile is ok because we already know |
78 |
|
* that the complete path does not refer to an existing file. *) |
79 |
|
loop (P.splitDirFile f) |
80 |
|
end |
81 |
|
|
82 |
|
fun getId f = (PRESENT (F.fileId f) handle _ => ABSENT (expandPath f)) |
83 |
|
|
84 |
type elaboration = { stamp : unit ref, |
type elaboration = { stamp : unit ref, |
85 |
name : string, |
name : string, |
|
Legend:
Removed from v.373 |
|
changed lines |
|
Added in v.374 |
|
|