use provided config file path instead of name

fixes a bug which made it impossible to specify a configuration file outside of the root directory.
This commit is contained in:
Luke Cowell 2021-07-31 07:33:42 -07:00 committed by Vincent Prouillet
parent 9275d932e2
commit 28c3dac0ab

View file

@ -294,12 +294,12 @@ pub fn serve(
return Err(format!("Cannot start server on address {}.", address).into());
}
let config_filename = config_file.file_name().unwrap().to_str().unwrap_or("config.toml");
let config_path = config_file.to_str().unwrap_or("config.toml");
// An array of (path, bool, bool) where the path should be watched for changes, and the boolean value
// indicates whether this file/folder must exist for zola serve to operate
let watch_this = vec![
(config_filename, WatchMode::Required),
(config_path, WatchMode::Required),
("content", WatchMode::Required),
("sass", WatchMode::Condition(site.config.compile_sass)),
("static", WatchMode::Optional),
@ -517,7 +517,7 @@ pub fn serve(
);
let start = Instant::now();
match detect_change_kind(&root_dir, &path, &config_filename) {
match detect_change_kind(&root_dir, &path, &config_path) {
(ChangeKind::Content, _) => {
console::info(&format!("-> Content changed {}", path.display()));