mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-12 15:14:35 +01:00
fix reshade
This commit is contained in:
@@ -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.");
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user