Implement Path.explode_exn in terms of Path.explode

This commit is contained in:
Rudi Grinberg 2018-05-03 21:22:45 +07:00
parent 65385bbaa4
commit 46d74e1a96
1 changed files with 4 additions and 7 deletions

View File

@ -418,13 +418,10 @@ let explode t =
None
let explode_exn t =
if is_root t then
[]
else if is_local t then
String.split t ~on:'/'
else
Exn.code_error "Path.explode_exn"
["path", Sexp.atom_or_quoted_string t]
match explode t with
| Some s -> s
| None -> Exn.code_error "Path.explode_exn"
["path", Sexp.atom_or_quoted_string t]
let exists t =
try Sys.file_exists (to_string t)