make standard config file path in home-directory work properly

This commit is contained in:
Aaska Black Wolf
2026-09-02 10:59:22 +02:00
parent 1d329a6e50
commit 5e2fac03f4
+4 -3
View File
@@ -30,7 +30,8 @@ struct DbData{
//fn main() {
fn main () {
let mut config_file_path = "~/.isolated-switches/config.json";
let home_dir = env::home_dir().expect("Could not determine home directory");
let mut config_file_path: &str = &(home_dir.to_string_lossy() + "/.isolated-switches/config.json");
// read and parse command line parameters
let args: Vec<String> = env::args().collect();
@@ -76,8 +77,8 @@ fn main () {
// read and parse configuration file
fn read_config(config_file_path: &str) -> Config {
let config_file = File::open(&config_file_path)
.expect("Could not read config file");
let config_file = File::open(config_file_path)
.expect(&("Could not read config file ".to_owned() + config_file_path ));
let config: Config = serde_json::from_reader(config_file)
.expect("file should be proper JSON");
config