commit e8405098f40d0730ef4cdb4bb743897f6e7472ac
parent 5ee7fab819433f1338e5290a0e03b358c59c44f3
Author: falkTX <falktx@falktx.com>
Date: Fri, 2 Dec 2022 08:59:13 +0000
Find local resources dir for Windows standalones
Signed-off-by: falkTX <falktx@falktx.com>
Diffstat:
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git 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