Fix plugin search path on Nix

Even its non-full GNUInstallDirs paths are absolute,
which is apparently allowed.
This commit is contained in:
Přemysl Eric Janouch 2023-06-29 02:24:59 +02:00
parent 11567dc05c
commit c420e3ce86
Signed by: p
GPG Key ID: A0420B94F92B9493
3 changed files with 4 additions and 1 deletions

View File

@ -70,6 +70,7 @@ set (project_headers ${PROJECT_BINARY_DIR}/config.h)
# Generate a configuration file
include (GNUInstallDirs)
set (plugin_dir ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME})
set (full_plugin_dir ${CMAKE_INSTALL_FULL_LIBDIR}/${PROJECT_NAME})
configure_file (${PROJECT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h)
include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})

View File

@ -5,6 +5,6 @@
#define PROGRAM_VERSION "${PROJECT_VERSION}"
#cmakedefine WITH_LUA
#define PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/${plugin_dir}"
#define PLUGIN_DIR "${full_plugin_dir}"
#endif // ! CONFIG_H

View File

@ -840,6 +840,7 @@ load_one_plugin (struct app_context *ctx, const char *name, const char *path)
void *table = dlopen (path, RTLD_LAZY | RTLD_LOCAL);
if (!table)
{
print_debug ("%s", path);
print_error ("could not load `%s': %s", name, dlerror ());
return false;
}
@ -874,6 +875,7 @@ load_plugins (struct app_context *ctx)
DIR *dir = opendir (plugin_dir);
if (!dir)
{
print_debug ("%s", plugin_dir);
print_fatal ("%s: %s",
"cannot open plugin directory", strerror (errno));
return false;