diff --git a/rog-aura/src/aura_detection.rs b/rog-aura/src/aura_detection.rs index 3f5467c4..05935818 100644 --- a/rog-aura/src/aura_detection.rs +++ b/rog-aura/src/aura_detection.rs @@ -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::(&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 }