Chore: attempt another CI fix

This commit is contained in:
Denis Benato
2025-11-16 14:43:40 +01:00
parent 031a36242b
commit 45f8b8ffb0

View File

@@ -168,20 +168,18 @@ impl LedSupportFile {
// development environments), attempt to load the bundled // development environments), attempt to load the bundled
// `data/aura_support.ron` from the crate so tests and local runs // `data/aura_support.ron` from the crate so tests and local runs
// behave the same as when the package is installed. // behave the same as when the package is installed.
if let Ok(path) = std::env::var("CARGO_MANIFEST_DIR") { // Attempt to load a bundled `aura_support.ron` included at compile time.
let mut pb = std::path::PathBuf::from(path); // Using `include_str!` ensures the data is available regardless of
pb.push("data/aura_support.ron"); // runtime `CARGO_MANIFEST_DIR` or CI environment differences.
if let Ok(buf) = std::fs::read_to_string(&pb) { let bundled_buf = include_str!("../data/aura_support.ron");
if !buf.is_empty() { if !bundled_buf.is_empty() {
if let Ok(tmp) = ron::from_str::<LedSupportFile>(&buf) { if let Ok(tmp) = ron::from_str::<LedSupportFile>(bundled_buf) {
data.0.append(&mut tmp.0.clone()); data.0.append(&mut tmp.0.clone());
data.0.sort_by(|a, b| a.device_name.cmp(&b.device_name)); data.0.sort_by(|a, b| a.device_name.cmp(&b.device_name));
info!("Loaded bundled LED support data from {}", pb.display()); info!("Loaded bundled LED support data (embedded)");
return Some(data); return Some(data);
} else { } else {
warn!("Could not parse bundled data file: {}", pb.display()); warn!("Could not parse embedded bundled data file");
}
}
} }
} }