fix: update to output error when using --layout (#1413)

This commit is contained in:
Jae-Heon Ji 2022-05-12 22:42:31 +09:00 committed by GitHub
parent f04e5bd873
commit 8c38b39ef6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -260,8 +260,14 @@ impl LayoutFromYamlIntermediate {
layout_dir: Option<&PathBuf>,
) -> LayoutFromYamlIntermediateResult {
match layout_dir {
Some(dir) => Self::from_path(&dir.join(layout))
.or_else(|_| LayoutFromYamlIntermediate::from_default_assets(layout)),
Some(dir) => {
let layout_path = &dir.join(layout);
if layout_path.exists() {
Self::from_path(layout_path)
} else {
LayoutFromYamlIntermediate::from_default_assets(layout)
}
}
None => LayoutFromYamlIntermediate::from_default_assets(layout),
}
}