-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwalker.v
More file actions
30 lines (26 loc) · 684 Bytes
/
Copy pathwalker.v
File metadata and controls
30 lines (26 loc) · 684 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
module graphify
import os
// directories we never descend into (dot-prefixed dirs are also skipped globally).
const skip_dirs = ['node_modules', '_test', 'thirdparty']
// find_source_files walks `root` and returns the path of every `.v` file found.
pub fn find_source_files(root string) []string {
mut out := []string{}
walk(os.real_path(root), mut out)
return out
}
fn walk(dir string, mut out []string) {
entries := os.ls(dir) or { return }
for e in entries {
full := os.join_path(dir, e)
if os.is_dir(full) {
if e.starts_with('.') || e in skip_dirs {
continue
}
walk(full, mut out)
continue
}
if os.file_ext(full) == '.v' {
out << full
}
}
}