Fix: CI testing

This commit is contained in:
Denis Benato
2025-11-15 18:57:10 +01:00
parent 907d4694f3
commit 8ad26ad136

View File

@@ -164,6 +164,27 @@ impl LedSupportFile {
return Some(data);
}
// If the system-wide files were not found (typical in CI or
// development environments), attempt to load the bundled
// `data/aura_support.ron` from the crate so tests and local runs
// behave the same as when the package is installed.
if let Ok(path) = std::env::var("CARGO_MANIFEST_DIR") {
let mut pb = std::path::PathBuf::from(path);
pb.push("data/aura_support.ron");
if let Ok(buf) = std::fs::read_to_string(&pb) {
if !buf.is_empty() {
if let Ok(tmp) = ron::from_str::<LedSupportFile>(&buf) {
data.0.append(&mut tmp.0.clone());
data.0.sort_by(|a, b| a.device_name.cmp(&b.device_name));
info!("Loaded bundled LED support data from {}", pb.display());
return Some(data);
} else {
warn!("Could not parse bundled data file: {}", pb.display());
}
}
}
}
warn!("Does {} exist?", ASUS_LED_MODE_USER_CONF);
None
}