fix reshade

This commit is contained in:
SpikeHD
2022-07-26 20:59:33 -07:00
parent 0971f5b826
commit 79891238b6
3 changed files with 18 additions and 1 deletions

View File

@@ -242,6 +242,7 @@ pub fn install_ca_files(cert_path: &Path) {
crate::system_helpers::run_command(
"certutil",
vec!["-user", "-addstore", "Root", cert_path.to_str().unwrap()],
None,
);
println!("Installed certificate.");
}

View File

@@ -26,13 +26,28 @@ pub fn run_program_relative(path: String, args: Option<String>) {
}
#[tauri::command]
pub fn run_command(program: &str, args: Vec<&str>) {
pub fn run_command(program: &str, args: Vec<&str>, relative: Option<bool>) {
let prog = program.to_string();
let args = args.iter().map(|s| s.to_string()).collect::<Vec<String>>();
// Commands should not block (this is for the reshade injector mostly)
std::thread::spawn(move || {
// Save the current working directory
let cwd = std::env::current_dir().unwrap();
if relative.unwrap_or(false) {
// Set the new working directory to the path before the executable
let mut path_buf = std::path::PathBuf::from(&prog);
path_buf.pop();
// Set new working directory
std::env::set_current_dir(&path_buf).unwrap();
}
cmd(prog, args).run().unwrap();
// Restore the original working directory
std::env::set_current_dir(&cwd).unwrap();
});
}

View File

@@ -115,6 +115,7 @@ export class ExtrasMenu extends React.Component<IProps, IState> {
await invoke('run_command', {
program: config.reshade_path,
args: [await getGameExecutable()],
relative: true,
})
}