From c7d4a426966c98fe2fd6dfd237788878112d99ce Mon Sep 17 00:00:00 2001 From: Matt Firth Date: Thu, 4 Jan 2024 01:16:10 +0000 Subject: [PATCH] getBearDataFileDirectory function --- .../binaural_monitoring_plugin_processor.cpp | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp index 429e61026..f265aed8c 100644 --- a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp +++ b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp @@ -35,6 +35,17 @@ struct BufferTraits> { } }; +juce::File getBearDataFileDirectory(){ + auto vstPath = juce::File::getSpecialLocation( + juce::File::SpecialLocationType::currentExecutableFile); + vstPath = vstPath.getParentDirectory(); +#ifdef __APPLE__ + vstPath = vstPath.getParentDirectory(); + vstPath = vstPath.getChildFile("Resources"); +#endif + return vstPath; +}; + } // namespace plugin } // namespace ear @@ -128,15 +139,10 @@ EarBinauralMonitoringAudioProcessor::EarBinauralMonitoringAudioProcessor() connector_->parameterValueChanged(11, oscInvertQuatY_->get()); connector_->parameterValueChanged(12, oscInvertQuatZ_->get()); - auto vstPath = juce::File::getSpecialLocation( - juce::File::SpecialLocationType::currentExecutableFile); - vstPath = vstPath.getParentDirectory(); -#ifdef __APPLE__ - vstPath = vstPath.getParentDirectory(); - vstPath = vstPath.getChildFile("Resources"); -#endif - vstPath = vstPath.getChildFile(BEAR_DATA_FILE); - bearDataFilePath = vstPath.getFullPathName().toStdString(); + bearDataFilePath = getBearDataFileDirectory() + .getChildFile(BEAR_DATA_FILE) + .getFullPathName() + .toStdString(); oscReceiver.onReceiveEuler = [this](ListenerOrientation::Euler euler) { connector_->setEuler(euler);