MacOS Fixes

This commit is contained in:
2025-07-25 14:46:01 -07:00
parent 78f38cc0e2
commit 8f6b06271c

View File

@@ -144,13 +144,20 @@ async fn download(
.await
.unwrap();
#[cfg(target_os = "linux")]
#[cfg(any(target_os = "linux", target_os = "macos"))]
{
let executable_path = game_path.join(&name).join(&executable);
#[cfg(target_os = "linux")]
{
let mut perms = fs::metadata(&executable_path).unwrap().permissions();
perms.set_mode(0o755);
fs::set_permissions(executable_path, perms).unwrap();
}
#[cfg(target_os = "macos")]
{
let _ = Command::new(format!("osascript -e 'do shell script chmod 755 {} with prompt Administrator is required to make Berry Dash v{} executable with administrator privileges'", &executable_path.to_string_lossy(), &name)).spawn();
}
}
app.emit("download-done", &name).unwrap();
Ok(())
@@ -210,7 +217,14 @@ fn launch_game(app: AppHandle, name: String, executable: String, wine: bool) {
.show(|_| {});
return;
}
if platform() == "macos" {
Command::new("open")
.arg(&game_path)
.current_dir(&game_folder)
.spawn()
} else {
Command::new(&game_path).current_dir(&game_folder).spawn()
}
};
match result {