mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-13 15:44:35 +01:00
re-add opening as admin
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -47,7 +47,6 @@ pub fn set_proxy_addr(addr: String) {
|
||||
} else {
|
||||
*SERVER.lock().unwrap() = addr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user