;path.ss<br>;LGPL licensed<br><br>#lang typed-scheme<br><br>(require/opaque-type Path-for-some-system path-for-some-system? scheme)<br>(define-type-alias String/Path-for-some-system (U String Path-for-some-system))<br>(define-type-alias String/Path (U String Path))<br>
<br>(require/typed scheme/path<br> [find-relative-path (String/Path-for-some-system String/Path-for-some-system -> Path-for-some-system)] <br> [explode-path (String/Path-for-some-system -> (Listof (U Path-for-some-system 'up 'same)))]<br>
[simple-form-path (String/Path -> Path)]<br> [normalize-path<br> (case-lambda (String/Path -> Path)<br> (String/Path String/Path -> Path))] ;second argument can be made more expressive by using a complete-path opaque type<br>
[filename-extension (String/Path-for-some-system -> (Option Bytes))]<br> [file-name-from-path (String/Path-for-some-system -> (Option Path-for-some-system))]<br> [path-only (String/Path-for-some-system -> Path-for-some-system)]<br>
[some-system-path->string (Path-for-some-system -> String)]<br> [string->some-system-path (String (U 'unix 'windows) -> Path-for-some-system)])<br><br>(provide find-relative-path<br>
explode-path<br> simple-form-path<br> normalize-path<br> filename-extension<br> file-name-from-path<br> path-only<br> some-system-path->string<br> string->some-system-path)<br>
<br>