Browse Source

Add carla_get_library_filename/folder functions, needed for LMMS

tags/1.9.5
falkTX 10 years ago
parent
commit
0e00f85c9a
3 changed files with 50 additions and 2 deletions
  1. +10
    -0
      source/backend/CarlaHost.h
  2. +33
    -1
      source/backend/CarlaStandalone.cpp
  3. +7
    -1
      source/backend/engine/CarlaEngineNative.cpp

+ 10
- 0
source/backend/CarlaHost.h View File

@@ -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 */

+ 33
- 1
source/backend/CarlaStandalone.cpp View File

@@ -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"


+ 7
- 1
source/backend/engine/CarlaEngineNative.cpp View File

@@ -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);
}


Loading…
Cancel
Save