From 249809ea4b347b600c9ed03ee8ae9ab58dd4e9e4 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 4 Jun 2023 08:45:38 +0200 Subject: [PATCH] Fix conflict with other tools using Carla Signed-off-by: falkTX --- source/backend/engine/CarlaEngineNative.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/backend/engine/CarlaEngineNative.cpp b/source/backend/engine/CarlaEngineNative.cpp index 30806d377..e1c8f3f80 100644 --- a/source/backend/engine/CarlaEngineNative.cpp +++ b/source/backend/engine/CarlaEngineNative.cpp @@ -45,6 +45,10 @@ #include "water/xml/XmlDocument.h" #include "water/xml/XmlElement.h" +#ifdef CARLA_OS_WIN +# include +#endif + #ifdef USING_JUCE # include "carla_juce/carla_juce.h" #endif @@ -1274,6 +1278,12 @@ protected: 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); @@ -1303,6 +1313,11 @@ protected: if (kIsPatchbay) patchbayRefresh(true, false, false); + +#ifdef CARLA_OS_WIN + chdir(oldcwd); + std::free(oldcwd); +#endif } else {