std.fs.split_path_by_dir

std.fs

split_path_by_dir(pathname) -> dirs

Split a pathname into an array of directory components

Splits a pathname on / separators and returns the components as an ordered array. Leading slashes are discarded; the final component is included even if it names a file rather than a directory.

Example: split_path_by_dir("/usr/local/bin"){"usr","local","bin"}