Fix source-links for files with absolute-paths
`clean_srcpath` tries to make the source-path relative to `src_root`, but this didn't work since `src_root` itself wasn't absolute.
This commit is contained in:
parent
27ca2507de
commit
cf76fcf30d
3 changed files with 33 additions and 8 deletions
|
@ -48,6 +48,7 @@ use std::collections::HashMap;
|
|||
use std::path::PathBuf;
|
||||
use std::rc::Rc;
|
||||
use std::u32;
|
||||
use std::env::current_dir;
|
||||
|
||||
use core::DocContext;
|
||||
use doctree;
|
||||
|
@ -201,7 +202,13 @@ impl<'a, 'tcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx> {
|
|||
}
|
||||
|
||||
let src = match cx.input {
|
||||
Input::File(ref path) => path.clone(),
|
||||
Input::File(ref path) => {
|
||||
if path.is_absolute() {
|
||||
path.clone()
|
||||
} else {
|
||||
current_dir().unwrap().join(path)
|
||||
}
|
||||
},
|
||||
Input::Str(_) => PathBuf::new() // FIXME: this is wrong
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue