use src key in book.json when given

This commit is contained in:
Gambhiro 2016-12-07 09:38:56 +00:00
parent cf35e08abc
commit a9e5dc63f1
1 changed files with 15 additions and 1 deletions

View File

@ -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