added ~ subsitution for the config, paths with ~/ work now

i18n
Rafael Madriz 3 years ago
parent 16b3888082
commit e09024c601
No known key found for this signature in database
GPG Key ID: CB97071D2AF98474

@ -1,4 +1,4 @@
cache = "/home/ali/.ame"
cache = "~/.cache/ame"
[backends]
pacman = true

@ -42,6 +42,8 @@ fn main() {
if fs::read_to_string("/etc/ame.toml").expect("unable to open config file! (/etc/ame.toml)") != "" {
confile.read_to_string(&mut config).expect("Unable to read the Config file (/etc/ame.toml)");
let homepath = std::env::var("HOME").unwrap();
config=config.replace("~", &homepath);
configfile = toml::from_str(&config).unwrap();
}

@ -41,6 +41,8 @@ pub fn printconfig() {
let mut configfile: General = toml::from_str(&defaultconfig).unwrap();
if fs::read_to_string("/etc/ame.toml").expect("unable to open config file! (/etc/ame.toml)") != "" {
confile.read_to_string(&mut config).expect("Unable to read the Config file (/etc/ame.toml)");
let homepath = std::env::var("HOME").unwrap();
config=config.replace("~", &homepath);
configfile = toml::from_str(&config).unwrap();
}
println!("\

Loading…
Cancel
Save