equal
deleted
inserted
replaced
193 | eval x = [x]; |
193 | eval x = [x]; |
194 |
194 |
195 val expand = rep #> maps eval #> norm #> Path; |
195 val expand = rep #> maps eval #> norm #> Path; |
196 |
196 |
197 |
197 |
198 (* smart replacement of $ISABELLE_HOME *) |
198 (* smart implode *) |
199 |
199 |
200 fun smart_implode path = |
200 fun smart_implode path = |
201 let |
201 let |
202 val full_name = implode_path (expand path); |
202 val full_name = implode_path (expand path); |
203 val isabelle_home = implode_path (expand (explode_path "~~")); |
203 fun fold_path a = |
|
204 let val b = implode_path (expand (explode_path a)) in |
|
205 if full_name = b then SOME a |
|
206 else |
|
207 (case try (unprefix (b ^ "/")) full_name of |
|
208 SOME name => SOME (a ^ "/" ^ name) |
|
209 | NONE => NONE) |
|
210 end; |
204 in |
211 in |
205 if full_name = isabelle_home then "~~" |
212 (case get_first fold_path ["~~", "$ISABELLE_HOME_USER", "~"] of |
206 else |
213 SOME name => name |
207 (case try (unprefix (isabelle_home ^ "/")) full_name of |
214 | NONE => implode_path path) |
208 SOME name => "~~/" ^ name |
|
209 | NONE => implode_path path) |
|
210 end; |
215 end; |
211 |
216 |
212 val position = Position.file o smart_implode; |
217 val position = Position.file o smart_implode; |
213 |
218 |
214 (*final declarations of this structure!*) |
219 (*final declarations of this structure!*) |