Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Alex-Beng/Yap
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Beng committed May 3, 2024
2 parents bec092a + 4d6b079 commit d07ba6b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ fn main() {
.get_matches();

//设置软件工作目录,避免下面未使用 PathBuf 的路径使用错误
let _ = env::set_current_dir(env::current_exe().unwrap().parent().unwrap());
let mut current_exe_dir = env::current_exe().unwrap();
let _ = current_exe_dir.pop();
let _ = env::set_current_dir(&current_exe_dir);

let dump: bool = matches.is_present("dump");
let dump_path = matches.value_of("dump").unwrap_or("./dumps/");
Expand Down Expand Up @@ -174,7 +176,7 @@ fn main() {
let mut pick_key_json = pick_key;
let mut uid_mask_on = true;
let mut press_y = true;
let config_path = env::current_exe().unwrap().parent().unwrap().to_path_buf().join("config.json");
let config_path = current_exe_dir.join("config.json").clone();
if config_path.exists() {
let config = fs::read_to_string(config_path).unwrap();
let config: serde_json::Value = serde_json::from_str(&config).unwrap();
Expand Down Expand Up @@ -327,7 +329,7 @@ fn main() {
let pk_config = PickupCofig {
info,
hwnd,
bw_path: env::current_exe().unwrap().parent().unwrap().to_string_lossy().to_string(),
bw_path: current_exe_dir.to_string_lossy().to_string().clone(),
use_l,
press_y,
dump,
Expand Down

0 comments on commit d07ba6b

Please sign in to comment.