From e75f65ab56dbee9b51c9e4676b7f1cf29289b2e6 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 18 Sep 2022 17:54:05 -0700 Subject: [PATCH] --no-admin and fix migoto setting --- package.json | 2 +- src-tauri/src/main.rs | 6 +++--- src-tauri/src/system_helpers.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index a530916..4a13950 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "test": "react-scripts test", "eject": "react-scripts eject", "tauri": "tauri", - "start:dev": "tauri dev", + "start:dev": "tauri dev -- -- --no-admin", "format": "cargo fmt --manifest-path ./src-tauri/Cargo.toml --all && yarn prettier --write --cache --loglevel warn .", "lint": "cargo clippy --manifest-path ./src-tauri/Cargo.toml --no-default-features && yarn tsc --noEmit && yarn eslint src", "lint:fix": "cargo clippy --manifest-path ./src-tauri/Cargo.toml --no-default-features --fix --allow-dirty && yarn tsc --noEmit && yarn eslint --fix src", diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index a31738e..f2de1db 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -51,7 +51,9 @@ async fn arg_handler(args: &[String]) { } fn main() { - if !is_elevated() { + let args: Vec = std::env::args().collect(); + + if !is_elevated() && !has_arg(&args, "--no-admin") { println!("==============================================================================="); println!("You running as a non-elevated user. Some stuff will almost definitely not work."); println!("==============================================================================="); @@ -69,8 +71,6 @@ fn main() { exe_path.pop(); std::env::set_current_dir(&exe_path).unwrap(); - let args: Vec = std::env::args().collect(); - block_on(arg_handler(&args)); // For disabled GUI diff --git a/src-tauri/src/system_helpers.rs b/src-tauri/src/system_helpers.rs index d619934..a1c229b 100644 --- a/src-tauri/src/system_helpers.rs +++ b/src-tauri/src/system_helpers.rs @@ -115,7 +115,7 @@ pub fn set_migoto_target(path: String, migoto_path: String) -> bool { // Set options conf .with_section(Some("Loader")) - .set("target", pathbuf.to_str().unwrap()); + .set("target", pathbuf.file_name().unwrap().to_str().unwrap()); // Write file match conf.write_to_file(&migoto_pathbuf) {