Files
herolib/lib/core/pathlib/path_recursive_txt.v
2024-12-25 09:23:31 +01:00

19 lines
439 B
V

module pathlib
// get all text for path and underneith (works for dir & file)
pub fn (mut path Path) recursive_text() ![]string {
mut res := []string{}
// path.check_exists()!
// console.print_debug("path recursive text: $path.path")
if path.cat == .file {
c := path.read()!
res << c.split_into_lines()
} else {
mut pl := path.list(recursive: true)!
for mut p in pl.paths {
res << p.recursive_text()!
}
}
return res
}