From 0e00f85c9a9ee77890df224823ca1a7c2180b3ba Mon Sep 17 00:00:00 2001 From: falkTX Date: Tue, 16 Sep 2014 16:20:47 +0100 Subject: [PATCH] Add carla_get_library_filename/folder functions, needed for LMMS --- source/backend/CarlaHost.h | 10 ++++++ source/backend/CarlaStandalone.cpp | 34 ++++++++++++++++++++- source/backend/engine/CarlaEngineNative.cpp | 8 ++++- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/source/backend/CarlaHost.h b/source/backend/CarlaHost.h index 5d1e17f54..5734474a6 100644 --- a/source/backend/CarlaHost.h +++ b/source/backend/CarlaHost.h @@ -994,6 +994,16 @@ CARLA_EXPORT const char* carla_get_host_osc_url_tcp(); */ CARLA_EXPORT const char* carla_get_host_osc_url_udp(); +/*! + * Get the current carla library filename. + */ +CARLA_EXPORT const char* carla_get_library_filename(); + +/*! + * Get the folder where the current use carla library resides. + */ +CARLA_EXPORT const char* carla_get_library_folder(); + /** @} */ #endif /* CARLA_HOST_H_INCLUDED */ diff --git a/source/backend/CarlaStandalone.cpp b/source/backend/CarlaStandalone.cpp index de03ff2ed..1f21d2d24 100644 --- a/source/backend/CarlaStandalone.cpp +++ b/source/backend/CarlaStandalone.cpp @@ -73,7 +73,7 @@ struct CarlaBackendStandalone { engineOptions.preferUiBridges = false; using juce::File; - File binaryDir(File::getSpecialLocation(File::currentApplicationFile).getParentDirectory()); + File binaryDir(File::getSpecialLocation(File::currentExecutableFile).getParentDirectory()); engineOptions.binaryDir = carla_strdup_safe(binaryDir.getFullPathName().toRawUTF8()); engineOptions.resourceDir = carla_strdup_safe(binaryDir.getChildFile("resources").getFullPathName().toRawUTF8()); #else @@ -2428,6 +2428,38 @@ const char* carla_get_host_osc_url_udp() // ------------------------------------------------------------------------------------------------------------------- +const char* carla_get_library_filename() +{ + carla_debug("carla_get_library_filename()"); + + static CarlaString ret; + + if (ret.isEmpty()) + { + using juce::File; + ret = File(File::getSpecialLocation(File::currentExecutableFile)).getFullPathName().toRawUTF8(); + } + + return ret; +} + +const char* carla_get_library_folder() +{ + carla_debug("carla_get_library_folder()"); + + static CarlaString ret; + + if (ret.isEmpty()) + { + using juce::File; + ret = File(File::getSpecialLocation(File::currentExecutableFile).getParentDirectory()).getFullPathName().toRawUTF8(); + } + + return ret; +} + +// ------------------------------------------------------------------------------------------------------------------- + #include "CarlaPluginUI.cpp" #include "CarlaDssiUtils.cpp" #include "CarlaStateUtils.cpp" diff --git a/source/backend/engine/CarlaEngineNative.cpp b/source/backend/engine/CarlaEngineNative.cpp index d5ee7b5f6..81da05549 100644 --- a/source/backend/engine/CarlaEngineNative.cpp +++ b/source/backend/engine/CarlaEngineNative.cpp @@ -607,7 +607,13 @@ public: delete[] pData->options.binaryDir; pData->options.resourceDir = carla_strdup(pHost->resourceDir); - pData->options.binaryDir = carla_strdup(File(pHost->resourceDir).getParentDirectory().getFullPathName().toRawUTF8()); + +#ifndef CARLA_PLUGIN_EXPORT + if (gNeedsJuceHandling) + pData->options.binaryDir = carla_strdup(carla_get_library_folder()); + else +#endif + pData->options.binaryDir = carla_strdup(File(pHost->resourceDir).getParentDirectory().getFullPathName().toRawUTF8()); setCallback(_ui_server_callback, this); }