cheeky key path fix

This commit is contained in:
SpikeHD
2022-07-26 22:30:25 -07:00
parent 79891238b6
commit 281bfb5cea
2 changed files with 11 additions and 1 deletions

View File

@@ -24,6 +24,11 @@ mod web;
static WATCH_GAME_PROCESS: Lazy<Mutex<String>> = Lazy::new(|| Mutex::new(String::new()));
fn main() {
// Always set CWD to the location of the executable.
let mut exe_path = std::env::current_exe().unwrap();
exe_path.pop();
std::env::set_current_dir(&exe_path).unwrap();
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![
enable_process_watcher,

View File

@@ -111,7 +111,12 @@ fn replace_keys(data: &[u8]) -> Vec<u8> {
fn replace_rsa_key(old_data: &str, to_replace: &str, file_name: &str) -> String {
// Read dispatch key file
unsafe {
let mut new_key_file = match File::open(&("keys/".to_owned() + file_name)) {
// Get key folder from exe path
let mut exe_path = std::env::current_exe().unwrap();
exe_path.pop();
let key_folder = exe_path.to_str().unwrap().to_string();
let mut new_key_file = match File::open(format!("{}/keys/{}", key_folder, file_name)) {
Ok(file) => file,
Err(e) => {
println!("Failed to open keys/{}: {}", file_name, e);