let split p = let rec go p acc = let dir = dirname p in if dir = p then dir, acc else go dir (basename p :: acc) in go p []