aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-19 04:26:08 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-19 04:26:35 +0200
commitc0e1cd57b24469d36fa74b4ae37ba621eead07a0 (patch)
tree43416e3f314cbaf338642d26e52146ab466671a0
parent00184811ea6ba7f3bb53730ef026d653a5121e50 (diff)
downloadxK-c0e1cd57b24469d36fa74b4ae37ba621eead07a0.tar.gz
xK-c0e1cd57b24469d36fa74b4ae37ba621eead07a0.tar.xz
xK-c0e1cd57b24469d36fa74b4ae37ba621eead07a0.zip
Make sure to always find installed plugins
-rw-r--r--CMakeLists.txt1
-rw-r--r--config.h.in3
-rw-r--r--xB.c1
-rw-r--r--xC.c1
4 files changed, 5 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f678592..d8b2c70 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -225,7 +225,6 @@ add_custom_target (clang-tidy
# Installation
install (TARGETS xB xC xD DESTINATION ${CMAKE_INSTALL_BINDIR})
install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
-# XXX: our defaults for XDG_DATA_DIRS expect /usr/local/share or /usr/share
install (DIRECTORY plugins/xB/
DESTINATION ${CMAKE_INSTALL_DATADIR}/xB/plugins USE_SOURCE_PERMISSIONS)
install (DIRECTORY plugins/xC/
diff --git a/config.h.in b/config.h.in
index 7e68c14..6f3911f 100644
--- a/config.h.in
+++ b/config.h.in
@@ -3,6 +3,9 @@
#define PROGRAM_VERSION "${project_version}"
+// We use the XDG Base Directory Specification, but may be installed anywhere.
+#define PROJECT_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}"
+
#cmakedefine HAVE_READLINE
#cmakedefine HAVE_EDITLINE
#cmakedefine HAVE_LUA
diff --git a/xB.c b/xB.c
index f7c076b..3713724 100644
--- a/xB.c
+++ b/xB.c
@@ -1019,6 +1019,7 @@ plugin_resolve_relative_filename (const char *filename)
{
struct strv paths = strv_make ();
get_xdg_data_dirs (&paths);
+ strv_append (&paths, PROJECT_DATADIR);
char *result = resolve_relative_filename_generic
(&paths, PROGRAM_NAME "/plugins/", filename);
strv_free (&paths);
diff --git a/xC.c b/xC.c
index 211f3e0..eb09053 100644
--- a/xC.c
+++ b/xC.c
@@ -11540,6 +11540,7 @@ plugin_resolve_relative_filename (const char *filename)
{
struct strv paths = strv_make ();
get_xdg_data_dirs (&paths);
+ strv_append (&paths, PROJECT_DATADIR);
char *result = resolve_relative_filename_generic
(&paths, PROGRAM_NAME "/plugins/", filename);
strv_free (&paths);