From e8405098f40d0730ef4cdb4bb743897f6e7472ac Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 2 Dec 2022 08:59:40 +0000 Subject: [PATCH] Find local resources dir for Windows standalones Signed-off-by: falkTX --- distrho/src/DistrhoPluginJACK.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/distrho/src/DistrhoPluginJACK.cpp b/distrho/src/DistrhoPluginJACK.cpp index 94c9c300..6d61fb08 100644 --- a/distrho/src/DistrhoPluginJACK.cpp +++ b/distrho/src/DistrhoPluginJACK.cpp @@ -16,7 +16,7 @@ #include "DistrhoPluginInternal.hpp" -#if !defined(DISTRHO_OS_WINDOWS) && !defined(STATIC_BUILD) +#ifndef STATIC_BUILD # include "../DistrhoPluginUtils.hpp" #endif @@ -954,14 +954,14 @@ int main(int argc, char* argv[]) initSignalHandler(); - #if !defined(DISTRHO_OS_WINDOWS) && !defined(STATIC_BUILD) + #ifndef STATIC_BUILD // find plugin bundle static String bundlePath; if (bundlePath.isEmpty()) { String tmpPath(getBinaryFilename()); tmpPath.truncate(tmpPath.rfind(DISTRHO_OS_SEP)); - #ifdef DISTRHO_OS_MAC + #if defined(DISTRHO_OS_MAC) if (tmpPath.endsWith("/MacOS")) { tmpPath.truncate(tmpPath.rfind('/')); @@ -972,13 +972,18 @@ int main(int argc, char* argv[]) d_nextBundlePath = bundlePath.buffer(); } } + #else + #ifdef DISTRHO_OS_WINDOWS + const DWORD attr = GetFileAttributesA(tmpPath + DISTRHO_OS_SEP_STR "resources"); + if (attr != INVALID_FILE_ATTRIBUTES && (attr & FILE_ATTRIBUTE_DIRECTORY) != 0) #else if (access(tmpPath + DISTRHO_OS_SEP_STR "resources", F_OK) == 0) + #endif { bundlePath = tmpPath; d_nextBundlePath = bundlePath.buffer(); } - #endif + #endif } #endif