diff --git a/src/dmdoc/main.rs b/src/dmdoc/main.rs index 01c9e009..021020bf 100644 --- a/src/dmdoc/main.rs +++ b/src/dmdoc/main.rs @@ -97,15 +97,21 @@ fn main2() -> Result<(), Box> { index_path = context.config().dmdoc.index_file.clone(); } - // Any top-level directory which is `#include`d in the `.dme` (most - // importantly "code", but also "_maps", "interface", and any downstream - // modular folders) will be searched for `.md` files to include in the docs. - let mut code_directories = std::collections::HashSet::new(); - context.file_list().for_each(|path| { - if let Some(std::path::Component::Normal(first)) = path.components().next() { - code_directories.insert(first.to_owned()); - } - }); + let mut code_directories: std::collections::HashSet; + if context.config().dmdoc.module_directories.is_empty() { + // Any top-level directory which is `#include`d in the `.dme` (most + // importantly "code", but also "_maps", "interface", and any downstream + // modular folders) will be searched for `.md` files to include in the docs. + code_directories = Default::default(); + context.file_list().for_each(|path| { + if let Some(std::path::Component::Normal(first)) = path.components().next() { + code_directories.insert(first.to_owned()); + } + }); + } else { + // Use what the config specifies without any additional logic. + code_directories = context.config().dmdoc.module_directories.iter().map(std::ffi::OsString::from).collect(); + } // get a read on which types *have* docs let mut types_with_docs = BTreeMap::new(); diff --git a/src/dreammaker/config.rs b/src/dreammaker/config.rs index 3baabfb4..b0bc054e 100644 --- a/src/dreammaker/config.rs +++ b/src/dreammaker/config.rs @@ -54,6 +54,7 @@ pub struct CodeStandards { pub struct DMDoc { pub use_typepath_names: bool, pub index_file: Option, + pub module_directories: Vec, } // Debugger config options