diff --git a/Cargo.toml b/Cargo.toml index 381bbd0..88269cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "SC_Starter" -version = "1.9.1" +version = "1.9.2" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/main.rs b/src/main.rs index 1c8c923..538a0db 100644 --- a/src/main.rs +++ b/src/main.rs @@ -287,23 +287,11 @@ fn read_config(conf_path: &PathBuf, default_settings: &SettingsCollection) -> Se //println!("{:?}",&full_content[0..4]); //println!("{:?}",&full_content[5]); let useful_content: Vec<&str> = full_content[0..4].to_vec(); - let mut useful_path = full_content[4] - .to_string() - .replace("'", "") - .replace("\"", "") //引号删了 - .replace("\\", "/") //反斜杠转换为斜杠 - .replace("//", "/"); - while useful_path.starts_with(" ") || useful_path.ends_with(" ") || useful_path.ends_with("/") { - //删除所有开头和结尾的空格 - useful_path = useful_path - .strip_prefix(" ") - .unwrap() - .strip_prefix(" ") - .unwrap() - .strip_suffix("/") - .unwrap() - .to_string(); - } + let useful_path = { + let temp = full_content[4].replace("\\", "/").replace("//", "/"); + temp.trim_matches(['\\', '/', '\n', '\r', '"', '\'', ' ', '\t']) + .to_string() + }; //这个闭包接收两个String然后返回一个包装好的KeyStringGroups类型便于下面解析 let struct_pack = |x: Vec, y: String| KeyStringGroups {