Add runtime rtp getter (and in cli and configuration types)

This commit is contained in:
Matthias Beyer 2015-11-23 19:48:33 +01:00
parent 14d92d8b2f
commit e1faad7a28
3 changed files with 16 additions and 0 deletions

View file

@ -33,5 +33,9 @@ impl<'a> CliConfig<'a> {
pub fn is_debugging(&self) -> bool {
self.cli_matches.is_present("debug")
}
pub fn get_rtp(&self) -> Option<String> {
self.cli_matches.value_of("rtp").and_then(|s| Some(String::from(s)))
}
}

View file

@ -57,6 +57,10 @@ impl Configuration {
format!("{}{}", self.rtp, self.store_sub)
}
pub fn get_rtp(&self) -> String {
self.rtp.clone()
}
}
fn rtp_path(config: &CliConfig) -> String {

View file

@ -72,4 +72,12 @@ impl<'a> Runtime<'a> {
self.config.is_debugging() || self.configuration.is_verbose()
}
pub fn get_rtp(&self) -> String {
if let Some(rtp) = self.config.get_rtp() {
rtp
} else {
self.configuration.get_rtp()
}
}
}