summaryrefslogtreecommitdiffstats
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/driver/src/recipe.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/crates/driver/src/recipe.rs b/crates/driver/src/recipe.rs
index ec1c116..3a033f1 100644
--- a/crates/driver/src/recipe.rs
+++ b/crates/driver/src/recipe.rs
@@ -1,4 +1,4 @@
-use std::{collections::HashMap, fs::File, path::Path, result};
+use std::{collections::HashMap, ffi::OsStr, fs::File, path::Path, result};
use scoped_tls_hkt::scoped_thread_local;
use serde::{Deserialize, Deserializer};
@@ -47,8 +47,8 @@ fn read_recipe(path: &Path) -> Result<Recipe> {
Ok(recipe)
}
-fn is_yml(path: &Path) -> bool {
- path.extension() == Some("yml".as_ref())
+fn is_recipe(path: &Path) -> bool {
+ path.file_name().unwrap_or_default() == "build.yml"
}
pub fn read_recipes<P: AsRef<Path>>(path: P) -> Result<HashMap<TaskID, Vec<TaskDef>>> {
@@ -60,11 +60,15 @@ pub fn read_recipes<P: AsRef<Path>>(path: P) -> Result<HashMap<TaskID, Vec<TaskD
.filter_map(|e| e.ok())
{
let path = entry.path();
- if !path.is_file() || !is_yml(path) {
+ if !path.is_file() || !is_recipe(path) {
continue;
}
- let Some(Some(basename)) = path.file_stem().map(|n| n.to_str()) else {
+ let Some(basename) = path
+ .parent()
+ .and_then(Path::file_name)
+ .and_then(OsStr::to_str)
+ else {
continue;
};