Skip to content

Commit

Permalink
Fix conflict with other tools using Carla
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Jun 4, 2023
1 parent f1285f2 commit 43c3478
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions source/backend/engine/CarlaEngineNative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
#include "water/xml/XmlDocument.h"
#include "water/xml/XmlElement.h"

#ifdef CARLA_OS_WIN
# include <direct.h>
#endif

#ifdef USING_JUCE
# include "carla_juce/carla_juce.h"
#endif
Expand Down Expand Up @@ -1269,6 +1273,12 @@ class CarlaEngineNative : public CarlaEngine

fUiServer.setData(path, pData->sampleRate, pHost->uiName);

#ifdef CARLA_OS_WIN
// Fix conflict with other tools using Carla
char* const oldcwd = _getcwd(nullptr, 0);
chdir(pHost->resourceDir);
#endif

if (! fUiServer.startPipeServer(false))
{
pHost->dispatcher(pHost->handle, NATIVE_HOST_OPCODE_UI_UNAVAILABLE, 0, 0, nullptr, 0.0f);
Expand Down Expand Up @@ -1298,6 +1308,11 @@ class CarlaEngineNative : public CarlaEngine

if (kIsPatchbay)
patchbayRefresh(true, false, false);

#ifdef CARLA_OS_WIN
chdir(oldcwd);
std::free(oldcwd);
#endif
}
else
{
Expand Down

0 comments on commit 43c3478

Please sign in to comment.