Skip to content

Allow loading from reaper's system-wide plugin path #80

@dvzrv

Description

@dvzrv

Hi! 👋

When upgrading the Arch Linux package to 1.2.4.5 I noticed, that we have the user manually symlink the plugin into place (https://gitlab.archlinux.org/archlinux/packaging/packages/reapack/-/blob/519fb6d0af1f98d0672fd5c5e88b0e254bbe2ef0/reapack.install).

This appears to be due to

reapack/src/main.cpp

Lines 91 to 124 in 1727aa3

static bool checkLocation(REAPER_PLUGIN_HINSTANCE module)
{
// using FS::canonical is required on macOS Catalina and newer,
// whose dladdr automatically resolves symbolic links from the module's path
Path expected;
expected.append(ReaPack::resourcePath());
expected.append("UserPlugins");
expected.append(REAPACK_FILENAME);
expected = FS::canonical(expected);
#ifdef _WIN32
Win32::char_type self[MAX_PATH]{};
GetModuleFileName(module, self, static_cast<DWORD>(std::size(self)));
const Path current(Win32::narrow(self));
#else
Dl_info info{};
dladdr(reinterpret_cast<const void *>(&checkLocation), &info);
const Path &current = FS::canonical({info.dli_fname});
#endif
if(current == expected)
return true;
Win32::messageBox(Splash_GetWnd(), String::format(
"ReaPack was not loaded from the standard extension path"
" or its filename was altered.\n"
"Move or rename it to the expected location and retry.\n\n"
"Current: %s\n\nExpected: %s",
current.join().c_str(), expected.join().c_str()
).c_str(), "ReaPack: Installation path mismatch", MB_OK);
return false;
}

Is that a requirement by reaper itself?

If I remove this check, e.g.:

diff --git i/src/main.cpp w/src/main.cpp
index de93e98..cd967c2 100644
--- i/src/main.cpp
+++ w/src/main.cpp
@@ -109,18 +109,7 @@ static bool checkLocation(REAPER_PLUGIN_HINSTANCE module)
   const Path &current = FS::canonical({info.dli_fname});
 #endif

-  if(current == expected)
-    return true;
-
-  Win32::messageBox(Splash_GetWnd(), String::format(
-    "ReaPack was not loaded from the standard extension path"
-    " or its filename was altered.\n"
-    "Move or rename it to the expected location and retry.\n\n"
-    "Current: %s\n\nExpected: %s",
-    current.join().c_str(), expected.join().c_str()
-  ).c_str(), "ReaPack: Installation path mismatch", MB_OK);
-
-  return false;
+  return true;
 }

 extern "C" REAPER_PLUGIN_DLL_EXPORT int REAPER_PLUGIN_ENTRYPOINT(

I am able to start reaper and the plugin is found automatically, if I place it below /usr/lib/REAPER/Plugins/ (that's where/ how we package reaper on Arch Linux).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions