From f2ad6dd4d97892195e3ac8bdec9bad01119330d2 Mon Sep 17 00:00:00 2001 From: SurmanPP <70163032+SurmanPP@users.noreply.github.com> Date: Wed, 10 Feb 2021 17:48:01 +0100 Subject: [PATCH] os: fix os.walk, when passing paths ending with path_separator (#8672) --- vlib/os/os.v | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vlib/os/os.v b/vlib/os/os.v index 8af66f2749..b55ebdef31 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -463,8 +463,12 @@ pub fn walk(path string, f fn (string)) { return } mut files := ls(path) or { return } + mut local_path_separator := path_separator + if path.ends_with(path_separator) { + local_path_separator = '' + } for file in files { - p := path + path_separator + file + p := path + local_path_separator + file if is_dir(p) && !is_link(p) { walk(p, f) } else if exists(p) {