Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dvzrv opened this issue Mar 4, 2024 · 0 comments
Open

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

dvzrv opened this issue Mar 4, 2024 · 0 comments

Comments

@dvzrv
Copy link

dvzrv commented Mar 4, 2024

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant