Fix explode_path to work on absolute paths

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
Rudi Grinberg 2018-05-16 16:14:29 +07:00
parent 270e1ce846
commit da469e66f0
1 changed files with 3 additions and 2 deletions

View File

@ -2,11 +2,12 @@ let explode_path =
let rec loop path acc =
let dir = Filename.dirname path in
let base = Filename.basename path in
let acc = base :: acc in
if dir = Filename.current_dir_name then
base :: acc
else if dir = path then
acc
else
loop dir acc
loop dir (base :: acc)
in
fun path -> loop path []