From 46d74e1a965e30b51d5ebf666d371c3ad20c3f64 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 3 May 2018 21:22:45 +0700 Subject: [PATCH] Implement Path.explode_exn in terms of Path.explode --- src/stdune/path.ml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/stdune/path.ml b/src/stdune/path.ml index da114a6b..7477c738 100644 --- a/src/stdune/path.ml +++ b/src/stdune/path.ml @@ -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)