Skip to content

Commit

Permalink
vdoc: include src dir when trying to generate doc comments for modu…
Browse files Browse the repository at this point in the history
…le (#21505)
  • Loading branch information
ttytm committed May 15, 2024
1 parent 8a515c0 commit 9639f55
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cmd/tools/vdoc/vdoc.v
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,17 @@ fn (mut vd VDoc) generate_docs_from_file() {
for dirpath in dirs {
vd.vprintln('Generating ${out.typ} docs for "${dirpath}"')
mut dcs := doc.generate(dirpath, cfg.pub_only, true, cfg.platform, cfg.symbol_name) or {
vd.emit_generate_err(err)
exit(1)
// TODO: use a variable like `src_path := os.join_path(dirpath, 'src')` after `https://github.com/vlang/v/issues/21504`
if os.exists(os.join_path(dirpath, 'src')) {
doc.generate(os.join_path(dirpath, 'src'), cfg.pub_only, true, cfg.platform,
cfg.symbol_name) or {
vd.emit_generate_err(err)
exit(1)
}
} else {
vd.emit_generate_err(err)
exit(1)
}
}
if dcs.contents.len == 0 {
continue
Expand Down

0 comments on commit 9639f55

Please sign in to comment.