summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-12-19 21:22:43 +0100
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-12-19 21:22:43 +0100
commitce5728177b5da522d03e3c94171baa41aed4a453 (patch)
tree0b74a3ba3f6e6182a5e3e1925eba458def2a1b46
parent14466b156ca5b46b2b43ef483aa14018cc4542a2 (diff)
core: added basic multilib support, to allow dualbooting into different architectures with plugins installed in $HOME/.local/lib$ARCH/deadbeef
-rw-r--r--plugins.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins.c b/plugins.c
index d314570c..74afa4ee 100644
--- a/plugins.c
+++ b/plugins.c
@@ -814,6 +814,7 @@ plug_load_all (void) {
#ifndef ANDROID
char *xdg_local_home = getenv ("XDG_LOCAL_HOME");
char xdg_plugin_dir[1024];
+ char xdg_plugin_dir_explicit_arch[1024];
if (xdg_local_home) {
strncpy (xdg_plugin_dir, xdg_local_home, sizeof (xdg_plugin_dir));
@@ -826,16 +827,24 @@ plug_load_all (void) {
xdg_plugin_dir[0] = 0;
}
else {
+ // multilib support:
+ // 1. load from lib$ARCH if present
+ // 2. load from lib if present
int written = snprintf (xdg_plugin_dir, sizeof (xdg_plugin_dir), "%s/.local/lib/deadbeef", homedir);
if (written > sizeof (xdg_plugin_dir)) {
trace ("warning: XDG_LOCAL_HOME value is too long: %s. Ignoring.", xdg_local_home);
xdg_plugin_dir[0] = 0;
}
+ written = snprintf (xdg_plugin_dir_explicit_arch, sizeof (xdg_plugin_dir_explicit_arch), "%s/.local/lib%d/deadbeef", homedir, (int)(sizeof (long) * 8));
+ if (written > sizeof (xdg_plugin_dir_explicit_arch)) {
+ trace ("warning: XDG_LOCAL_HOME value is too long: %s. Ignoring.", xdg_local_home);
+ xdg_plugin_dir_explicit_arch[0] = 0;
+ }
}
}
// load from HOME 1st, than replace from installdir if needed
- const char *plugins_dirs[] = { xdg_plugin_dir, dirname, NULL };
+ const char *plugins_dirs[] = { xdg_plugin_dir_explicit_arch, xdg_plugin_dir, dirname, NULL };
// If xdg_plugin_dir and dirname is the same, we should avoid each plugin
// to be load twice.