From 79145859d5bb3388adda7e05418bd5313259e87f Mon Sep 17 00:00:00 2001 From: "jie.caicj" Date: Fri, 10 Jun 2022 16:15:01 +0800 Subject: [PATCH] fix import config bug when use filename insteadof path --- src/main.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 8a5b5717a..9b665d778 100644 --- a/src/main.rs +++ b/src/main.rs @@ -134,7 +134,16 @@ fn main() { } } else if args[0] == "--import-config" { if args.len() == 2 { - import_config(&args[1]); + let mut filepath = args[1].to_owned(); + let path = std::path::Path::new(&args[1]); + if !path.is_absolute() { + let mut cur = std::env::current_dir().unwrap(); + cur.push(path); + filepath = cur.to_str().unwrap().to_string(); + } else { + filepath = path.to_str().unwrap().to_string(); + } + import_config(&filepath); } return; } else if args[0] == "--password" {