Skip to content

Commit

Permalink
simplify step 3
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Apr 18, 2024
1 parent 35a67aa commit 2ea7139
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions cmd/tools/vdoc/files.v
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,18 @@ fn get_ignore_paths(path string) ![]string {
return res.map(it.replace('/', os.path_separator))
}

fn is_included(path string, ignore_paths []string) bool {
return if path != '' && ignore_paths.any(path.contains(it)) { false } else { true }
}

fn get_modules_list(opath string, ignore_paths2 []string) []string {
path := opath.trim_right('/\\')
names := os.ls(path) or { return [] }
mut ignore_paths := get_ignore_paths(path) or { []string{} }
ignore_paths << ignore_paths2
mut dirs := map[string]int{}
for name in names {
if name == 'testdata' || name == 'tests' {
if name in ['testdata', 'tests'] {
continue
}
fpath := os.join_path(path, name)
if os.is_dir(fpath) && is_included(fpath, ignore_paths) {
if os.is_dir(fpath) && !ignore_paths.any(fpath.contains(it)) {
current_ignore_paths := ignore_paths.filter(it.starts_with(fpath))
for k in get_modules_list(fpath, current_ignore_paths) {
dirs[k]++
Expand Down

0 comments on commit 2ea7139

Please sign in to comment.