mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 09:23:19 +01:00
Fix: CI testing
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user