fix: macOS

This commit is contained in:
Maarten van Heusden
2024-12-22 20:42:52 +01:00
parent 04e8498edb
commit 3155054531
2 changed files with 5 additions and 6 deletions

View File

@@ -44,6 +44,8 @@ async fn start_download(steam_download: steam::SteamDownload, app: AppHandle) {
let default_terminal = TERMINAL.get().unwrap();
let shell = app.shell();
let terminal_to_use = if steam_download.options().terminal().is_none() { default_terminal.first().unwrap() } else { &Terminal::from_index(&steam_download.options().terminal().unwrap()).unwrap() };
// Also change working directory
std::env::set_current_dir(&WORKING_DIR.get().unwrap()).unwrap();
println!("\n-------------------------DEBUG INFO------------------------");
println!("received these values from frontend:");
@@ -139,4 +141,4 @@ fn main() {
preload_vectum,
get_all_terminals
]).run(tauri::generate_context!()).expect("error while running tauri application");
}
}

View File

@@ -206,16 +206,13 @@ impl Terminal {
}
Terminal::Terminal => {
// Create a bash script and run that. Not very secure but it makes this easier.
let download_script = format!("#!/bin/bash\ncd {}\n{}",working_dir.as_path().display(), command[0]);
// println!("{}", download_script);
let download_script = format!("#!/bin/bash\ncd {}\n{}",working_dir.to_str().unwrap().replace(" ", "\\ "), command[0]);
fs::write("./script.sh", download_script).unwrap();
#[cfg(unix)]
{
//todo: test if still working
use std::os::unix::fs::PermissionsExt;
fs::set_permissions("./script.sh", fs::Permissions::from_mode(0o755)).unwrap(); // Won't run without executable permission
}
@@ -309,4 +306,4 @@ fn create_depotdownloader_command(steam_download: &SteamDownload) -> Vec<String>
vec![format!(r#".\DepotDownloader.exe -username {} -password {} -app {} -depot {} -manifest {} -dir {}"#, steam_download.username().clone().unwrap(), steam_download.password().clone().unwrap(), steam_download.app_id(), steam_download.depot_id(), steam_download.manifest_id(), output_dir)]
}
}
}
}