Dont add too many paths to PATH when searching for pandoc exe
This commit is contained in:
parent
a51cc3ffdd
commit
e42e51695b
1 changed files with 1 additions and 11 deletions
|
@ -4,15 +4,6 @@ use std::env::{current_dir, current_exe};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
|
||||||
fn add_path_hints(pandoc: &mut Pandoc, path: &mut PathBuf) {
|
|
||||||
let mut out = true;
|
|
||||||
while out {
|
|
||||||
pandoc.add_pandoc_path_hint(path);
|
|
||||||
out = path.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fn execute_pandoc(config: Config, input: String) -> Result<PandocOutput, PandocError> {
|
fn execute_pandoc(config: Config, input: String) -> Result<PandocOutput, PandocError> {
|
||||||
let mut renderer = Pandoc::new();
|
let mut renderer = Pandoc::new();
|
||||||
renderer.set_output_format(pandoc::OutputFormat::Html5, vec![]);
|
renderer.set_output_format(pandoc::OutputFormat::Html5, vec![]);
|
||||||
|
@ -21,8 +12,7 @@ fn execute_pandoc(config: Config, input: String) -> Result<PandocOutput, PandocE
|
||||||
renderer.set_output(pandoc::OutputKind::Pipe);
|
renderer.set_output(pandoc::OutputKind::Pipe);
|
||||||
renderer.add_option(pandoc::PandocOption::Smart);
|
renderer.add_option(pandoc::PandocOption::Smart);
|
||||||
renderer.add_option(pandoc::PandocOption::Standalone);
|
renderer.add_option(pandoc::PandocOption::Standalone);
|
||||||
add_path_hints(&mut renderer, &mut current_exe().unwrap());
|
renderer.add_pandoc_path_hint(current_exe().unwrap().parent().unwrap());
|
||||||
add_path_hints(&mut renderer, &mut current_dir().unwrap());
|
|
||||||
return renderer.execute();
|
return renderer.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue