diff --git a/rbx_reflector/plugin.lua b/rbx_reflector/plugin.lua index 0e4313d2a..21d6b3ad7 100644 --- a/rbx_reflector/plugin.lua +++ b/rbx_reflector/plugin.lua @@ -1,3 +1,7 @@ +if game.Name ~= "defaults-place.rbxlx" then + return +end + local HttpService = game:GetService("HttpService") local SERVER_URL = "http://localhost:22073" diff --git a/rbx_reflector/src/cli/defaults_place.rs b/rbx_reflector/src/cli/defaults_place.rs index b0ddbe8c5..430dbef36 100644 --- a/rbx_reflector/src/cli/defaults_place.rs +++ b/rbx_reflector/src/cli/defaults_place.rs @@ -2,7 +2,7 @@ use std::{ fmt::{self, Write}, fs, path::PathBuf, - process::Command, + process::{Command, Stdio}, sync::mpsc, time::Duration, }; @@ -63,6 +63,8 @@ fn save_place_in_studio(path: &PathBuf) -> anyhow::Result { log::info!("Starting Roblox Studio..."); let mut studio_process = Command::new(studio_install.application_path()) + .stdout(Stdio::null()) + .stderr(Stdio::null()) .arg(path) .spawn()?; @@ -85,7 +87,24 @@ fn save_place_in_studio(path: &PathBuf) -> anyhow::Result { } } - #[cfg(not(target_os = "windows"))] + #[cfg(target_os = "macos")] + { + let process_id = studio_process.id(); + let script = format!( + r#" +tell application "System Events" + set frontmost of the first process whose unix id is {process_id} to true + keystroke "s" using command down +end tell +"# + ); + + Command::new("osascript") + .args(["-e", script.as_str()]) + .output()?; + } + + #[cfg(not(any(target_os = "windows", target_os = "macos")))] println!("Please save the opened place in Roblox Studio (ctrl+s)."); loop { diff --git a/rbx_reflector/src/cli/dump.rs b/rbx_reflector/src/cli/dump.rs index 106221cee..f174661c0 100644 --- a/rbx_reflector/src/cli/dump.rs +++ b/rbx_reflector/src/cli/dump.rs @@ -1,5 +1,5 @@ -use std::path::PathBuf; use std::process::Command; +use std::{path::PathBuf, process::Stdio}; use anyhow::{bail, Context}; use clap::Parser; @@ -22,6 +22,8 @@ impl DumpSubcommand { RobloxStudio::locate().context("Could not locate Roblox Studio install")?; Command::new(studio_install.application_path()) + .stdout(Stdio::null()) + .stderr(Stdio::null()) .arg("-FullAPI") .arg(&self.output) .status()?;