From 829b9822cb77af70eae4bac5824bee6489faca82 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Fri, 21 Apr 2023 12:47:44 -0700 Subject: [PATCH] re-add opening as admin --- src-tauri/src/lang.rs | 4 ++-- src-tauri/src/main.rs | 2 +- src-tauri/src/proxy.rs | 1 - src-tauri/src/system_helpers.rs | 9 +++++---- src-tauri/src/unzip.rs | 5 ++++- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src-tauri/src/lang.rs b/src-tauri/src/lang.rs index b0b0323..a7c5b28 100644 --- a/src-tauri/src/lang.rs +++ b/src-tauri/src/lang.rs @@ -1,5 +1,5 @@ use crate::system_helpers::*; -use std::path::{ Path, PathBuf }; +use std::path::{Path, PathBuf}; #[tauri::command] pub async fn get_lang(window: tauri::Window, lang: String) -> String { @@ -55,4 +55,4 @@ pub fn emit_lang_err(window: tauri::Window, msg: String) { res_hash.insert("error".to_string(), msg); window.emit("lang_error", &res_hash).unwrap(); -} \ No newline at end of file +} diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index cb48a98..0eff28a 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -58,7 +58,7 @@ fn main() { println!("You running as a non-elevated user. Some stuff will almost definitely not work."); println!("==============================================================================="); - //reopen_as_admin(); + reopen_as_admin(); } // Setup datadir/cultivation just in case something went funky and it wasn't made diff --git a/src-tauri/src/proxy.rs b/src-tauri/src/proxy.rs index 67ec353..fea72fa 100644 --- a/src-tauri/src/proxy.rs +++ b/src-tauri/src/proxy.rs @@ -47,7 +47,6 @@ pub fn set_proxy_addr(addr: String) { } else { *SERVER.lock().unwrap() = addr; } - } #[async_trait] diff --git a/src-tauri/src/system_helpers.rs b/src-tauri/src/system_helpers.rs index 71c99b1..50eec24 100644 --- a/src-tauri/src/system_helpers.rs +++ b/src-tauri/src/system_helpers.rs @@ -81,7 +81,10 @@ pub fn run_jar(path: String, execute_in: String, java_path: String) { pub fn run_un_elevated(path: String) { // Open the program non-elevated. match open::with( - format!("cmd /min /C \"set __COMPAT_LAYER=RUNASINVOKER && start \"\" \"{}\"\"", path), + format!( + "cmd /min /C \"set __COMPAT_LAYER=RUNASINVOKER && start \"\" \"{}\"\"", + path + ), "C:\\Windows\\System32\\cmd.exe", ) { Ok(_) => (), @@ -165,9 +168,7 @@ pub fn set_migoto_delay(migoto_path: String) -> bool { }; // Set options - conf - .with_section(Some("Loader")) - .set("delay", "20"); + conf.with_section(Some("Loader")).set("delay", "20"); // Write file match conf.write_to_file(&migoto_pathbuf) { diff --git a/src-tauri/src/unzip.rs b/src-tauri/src/unzip.rs index bdc111c..e574405 100644 --- a/src-tauri/src/unzip.rs +++ b/src-tauri/src/unzip.rs @@ -109,7 +109,10 @@ pub fn unzip( if zipfile.contains("GIMI") { window - .emit("migoto_extracted", destpath.to_string() + "3DMigoto Loader.exe") + .emit( + "migoto_extracted", + destpath.to_string() + "3DMigoto Loader.exe", + ) .unwrap(); }