Skip to content

Commit 876ea78

Browse files
committed
Fix #131 where src and dest paths were not prefixed with the root directory if it was not the current directory
1 parent 10e7a41 commit 876ea78

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/book/bookconfig.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ impl BookConfig {
2323
author: String::new(),
2424
description: String::new(),
2525
root: root.to_owned(),
26-
dest: PathBuf::from("book"),
27-
src: PathBuf::from("src"),
26+
dest: root.join("book"),
27+
src: root.join("src"),
2828
indent_spaces: 4, // indentation used for SUMMARY.md
2929
multilingual: false,
3030
}

src/book/mdbook.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ impl MDBook {
4343

4444
MDBook {
4545
root: root.to_owned(),
46-
dest: PathBuf::from("book"),
47-
src: PathBuf::from("src"),
46+
dest: root.join("book"),
47+
src: root.join("src"),
4848

4949
title: String::new(),
5050
author: String::new(),
@@ -151,7 +151,8 @@ impl MDBook {
151151
debug!("[*]: item: {:?}", item);
152152
match *item {
153153
BookItem::Spacer => continue,
154-
BookItem::Chapter(_, ref ch) | BookItem::Affix(ref ch) => {
154+
BookItem::Chapter(_, ref ch) |
155+
BookItem::Affix(ref ch) => {
155156
if ch.path != PathBuf::new() {
156157
let path = self.src.join(&ch.path);
157158

@@ -279,8 +280,8 @@ impl MDBook {
279280
pub fn read_config(mut self) -> Self {
280281

281282
let config = BookConfig::new(&self.root)
282-
.read_config(&self.root)
283-
.to_owned();
283+
.read_config(&self.root)
284+
.to_owned();
284285

285286
self.title = config.title;
286287
self.description = config.description;

0 commit comments

Comments
 (0)