vdoc: return platform specific prefixes from .vdocignore files

pull/6550/head
Delyan Angelov 2020-10-03 17:40:22 +03:00
parent c324169af0
commit d93b0f047a
1 changed files with 4 additions and 2 deletions

View File

@ -856,6 +856,7 @@ fn get_ignore_paths(path string) ?[]string {
ignore_content := os.read_file(ignore_file_path) or { ignore_content := os.read_file(ignore_file_path) or {
return error_with_code('ignore file not found.', 1) return error_with_code('ignore file not found.', 1)
} }
mut res := []string{}
if ignore_content.trim_space().len > 0 { if ignore_content.trim_space().len > 0 {
rules := ignore_content.split_into_lines().map(it.trim_space()) rules := ignore_content.split_into_lines().map(it.trim_space())
mut final := []string{} mut final := []string{}
@ -866,13 +867,14 @@ fn get_ignore_paths(path string) ?[]string {
} }
final << rule final << rule
} }
return final.map(os.join_path(path, it.trim_right('/'))) res = final.map(os.join_path(path, it.trim_right('/')))
} else { } else {
mut dirs := os.ls(path) or { mut dirs := os.ls(path) or {
return []string{} return []string{}
} }
return dirs.map(os.join_path(path, it)).filter(os.is_dir(it)) res = dirs.map(os.join_path(path, it)).filter(os.is_dir(it))
} }
return res.map(it.replace('/', os.path_separator))
} }
fn lookup_module(mod string) ?string { fn lookup_module(mod string) ?string {