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(),
description: String::new(),
root: root.to_owned(),
dest: PathBuf::from("book"),
src: PathBuf::from("src"),
dest: root.join("book"),
src: root.join("src"),
indent_spaces: 4, // indentation used for SUMMARY.md
multilingual: false,
}

View File

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