From a9e5dc63f17ebaa99e532cfb8fd76b092894f008 Mon Sep 17 00:00:00 2001 From: Gambhiro Date: Wed, 7 Dec 2016 09:38:56 +0000 Subject: [PATCH] use src key in book.json when given --- src/book/bookconfig.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/book/bookconfig.rs b/src/book/bookconfig.rs index 107c0a42..60b052ee 100644 --- a/src/book/bookconfig.rs +++ b/src/book/bookconfig.rs @@ -70,7 +70,7 @@ impl BookConfig { self.description = a.to_string().replace("\"", "") } - // Destination + // Destination folder if let Some(a) = config.get("dest") { let dest = PathBuf::from(&a.to_string().replace("\"", "")); @@ -85,6 +85,20 @@ impl BookConfig { }, } } + + // Source folder + if let Some(a) = config.get("src") { + let src = PathBuf::from(&a.to_string().replace("\"", "")); + match src.is_relative() { + true => { + let src = self.get_root().join(&src).to_owned(); + self.set_src(&src); + }, + false => { + self.set_src(&src); + } + } + } } self