Fix #131 where src and dest paths were not prefixed with the root directory if it was not the current directory

This commit is contained in:
Mathieu David 2016-04-25 15:50:34 +02:00
parent 10e7a41d92
commit 876ea7895a
2 changed files with 8 additions and 7 deletions

View File

@ -23,8 +23,8 @@ impl BookConfig {
author: String::new(), author: String::new(),
description: String::new(), description: String::new(),
root: root.to_owned(), root: root.to_owned(),
dest: PathBuf::from("book"), dest: root.join("book"),
src: PathBuf::from("src"), src: root.join("src"),
indent_spaces: 4, // indentation used for SUMMARY.md indent_spaces: 4, // indentation used for SUMMARY.md
multilingual: false, multilingual: false,
} }

View File

@ -43,8 +43,8 @@ impl MDBook {
MDBook { MDBook {
root: root.to_owned(), root: root.to_owned(),
dest: PathBuf::from("book"), dest: root.join("book"),
src: PathBuf::from("src"), src: root.join("src"),
title: String::new(), title: String::new(),
author: String::new(), author: String::new(),
@ -151,7 +151,8 @@ impl MDBook {
debug!("[*]: item: {:?}", item); debug!("[*]: item: {:?}", item);
match *item { match *item {
BookItem::Spacer => continue, BookItem::Spacer => continue,
BookItem::Chapter(_, ref ch) | BookItem::Affix(ref ch) => { BookItem::Chapter(_, ref ch) |
BookItem::Affix(ref ch) => {
if ch.path != PathBuf::new() { if ch.path != PathBuf::new() {
let path = self.src.join(&ch.path); let path = self.src.join(&ch.path);
@ -279,8 +280,8 @@ impl MDBook {
pub fn read_config(mut self) -> Self { pub fn read_config(mut self) -> Self {
let config = BookConfig::new(&self.root) let config = BookConfig::new(&self.root)
.read_config(&self.root) .read_config(&self.root)
.to_owned(); .to_owned();
self.title = config.title; self.title = config.title;
self.description = config.description; self.description = config.description;