Skip to content

Commit

Permalink
Try standard location on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianEddy committed Nov 2, 2023
1 parent 479dfa7 commit daaa6e1
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/gyroflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,23 @@ impl InstanceData {
}
}

pub fn get_gyroflow_location() -> Option<String> {
match gyroflow_core::util::get_setting("exeLocation") {
Some(v) if !v.is_empty() => {
Some(v)
},
_ => {
if cfg!(target_os = "macos") && std::path::Path::new("/Applications/Gyroflow.app/Contents/MacOS/gyroflow").exists() {
Some("/Applications/Gyroflow.app".into())
} else {
None
}
}
}
}

pub fn open_gyroflow(&self) {
if let Some(v) = gyroflow_core::util::get_setting("exeLocation") {
if let Some(v) = Self::get_gyroflow_location() {
if !v.is_empty() {
if let Ok(project) = self.param_project_path.get_value() {
if !project.is_empty() {
Expand Down Expand Up @@ -834,7 +849,7 @@ impl Execute for GyroflowPlugin {
if in_args.get_name()? == "LoadLens" {
let instance_data: &mut InstanceData = effect.get_instance_data()?;
let lens_directory = || -> Option<std::path::PathBuf> {
let exe = gyroflow_core::util::get_setting("exeLocation").filter(|x| !x.is_empty())?;
let exe = InstanceData::get_gyroflow_location()?;
if cfg!(target_os = "macos") {
let mut path = std::path::Path::new(&exe).to_path_buf();
path.push("Contents");
Expand Down

0 comments on commit daaa6e1

Please sign in to comment.