2022-12-02 17:16:18 +00:00
|
|
|
diff --git a/src/dlmisc.c b/src/dlmisc.c
|
2023-01-12 07:20:50 +00:00
|
|
|
index f64c716..a413233 100644
|
2022-12-02 17:16:18 +00:00
|
|
|
--- a/src/dlmisc.c
|
|
|
|
+++ b/src/dlmisc.c
|
2023-01-12 07:20:50 +00:00
|
|
|
@@ -34,6 +34,9 @@
|
|
|
|
#endif
|
|
|
|
#include <limits.h>
|
|
|
|
|
|
|
|
+#include <sys/types.h>
|
|
|
|
+#include <dirent.h>
|
|
|
|
+
|
|
|
|
#if defined(HAVE_LIBDL) && defined(__GLIBC__) && !defined(__UCLIBC__)
|
|
|
|
#define DL_ORIGIN_AVAILABLE 1
|
|
|
|
#endif
|
|
|
|
@@ -79,6 +82,16 @@ static void snd_dlinfo_origin(char *path, size_t path_len)
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
+static unsigned int checkExist(const char* dirName) {
|
|
|
|
+ DIR* dir = opendir(dirName);
|
|
|
|
+ if(dir) {
|
|
|
|
+ closedir(dir);
|
|
|
|
+ return 1;
|
|
|
|
+ } else {
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* \brief Compose the dynamic path
|
|
|
|
@@ -94,8 +107,14 @@ int snd_dlpath(char *path, size_t path_len, const char *name)
|
|
|
|
const char *env = getenv("ALSA_PLUGIN_DIR");
|
2022-12-02 17:16:18 +00:00
|
|
|
if (env) {
|
|
|
|
snd_plugin_dir = strdup(env);
|
2023-01-12 07:20:50 +00:00
|
|
|
+ } else if(checkExist(ALSA_PLUGIN_DIR) ) {
|
|
|
|
+ snd_plugin_dir = strdup(ALSA_PLUGIN_DIR);
|
|
|
|
+ } else if(sizeof(void*) == 8 && checkExist("/usr/lib64/alsa-lib") ) {
|
|
|
|
+ snd_plugin_dir = strdup("/usr/lib64/alsa-lib");
|
|
|
|
+ } else if(sizeof(void*) == 4 && checkExist("/usr/lib32/alsa-lib") ) {
|
|
|
|
+ snd_plugin_dir = strdup("/usr/lib32/alsa-lib");
|
2022-12-02 17:16:18 +00:00
|
|
|
} else {
|
|
|
|
- snd_dlinfo_origin(path, path_len);
|
2023-01-12 07:20:50 +00:00
|
|
|
+ snd_plugin_dir = strdup("/usr/lib/alsa-lib");
|
2022-12-02 17:16:18 +00:00
|
|
|
}
|
|
|
|
snd_plugin_dir_set = 1;
|
|
|
|
}
|