mirror of
https://github.com/mii443/maudio-router.git
synced 2025-08-22 16:05:35 +00:00
config loading
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
use std::io::Read;
|
||||
|
||||
use crate::args::Run;
|
||||
|
||||
fn reshape_audio_data<T>(input: &[T], channels: usize) -> Vec<Vec<T>>
|
||||
@ -28,6 +30,25 @@ where
|
||||
output
|
||||
}
|
||||
|
||||
pub fn run(args: Run) {
|
||||
pub fn run(run: Run) {
|
||||
let config = std::path::Path::new(&run.config);
|
||||
|
||||
}
|
||||
if !config.exists() {
|
||||
eprintln!("Config file does not exists.");
|
||||
return;
|
||||
}
|
||||
|
||||
let mut buf = String::default();
|
||||
let mut config = if let Ok(config) = std::fs::File::open(&config) {
|
||||
config
|
||||
} else {
|
||||
eprintln!("Cannot open config file.");
|
||||
return;
|
||||
};
|
||||
|
||||
config.read_to_string(&mut buf).unwrap();
|
||||
|
||||
let config: crate::config::Config = serde_yaml::from_str(&buf).unwrap();
|
||||
|
||||
println!("{:?}", config);
|
||||
}
|
||||
|
Reference in New Issue
Block a user