[pulseaudio-discuss] [PATCH 2/9] Find modules and config files relative to the installed libraries.

Maarten Bosmans mkbosmans at gmail.com
Sat Mar 19 05:47:58 PDT 2011


2011/3/18 Colin Guthrie <gmane at colin.guthr.ie>:
> 'Twas brillig, and Maarten Bosmans at 16/03/11 09:55 did gyre and gimble:
>> +#ifdef OS_IS_WIN32
>> +    {
>> +        char *toplevel = pa_win32_get_toplevel(NULL);
>> +        c->dl_search_path = pa_sprintf_malloc("%s" PA_PATH_SEP "lib" PA_PATH_SEP "pulse-1.0" PA_PATH_SEP "modules", toplevel);
>> +    }
>> +#else
>
> Is there no nicer way to get this path than hard-coding pulse-1.0 here?

Makes sense. I didn't do it before because PA_MAJORMINOR is not easily
exported to a C define. I now used the fact that VERSION starts with
major.minor-. A bit ugly, but this code is only to provide some sane
default for the dl_search_path, before this patch you had to always
specify it at the command line on Windows.

Modified commit is at
https://github.com/mkbosmans/pulseaudio/commit/eb833da5700048953837bc75d42575ac771b2e67

That hunk is now:
@@ -159,7 +159,21 @@ pa_daemon_conf* pa_daemon_conf_new(void) {
     } else

 #endif
+#ifdef OS_IS_WIN32
+    {
+        char *t;
+        char *majorminor = pa_xstrdup(VERSION);
+        char *toplevel = pa_win32_get_toplevel(NULL);
+
+        if ((t = strchr(majorminor, '-')))
+          *t = '\0';
+
+        c->dl_search_path = pa_sprintf_malloc("%s" PA_PATH_SEP "lib"
PA_PATH_SEP "pulse-%s" PA_PATH_SEP "modules", toplevel, majorminor);
+        pa_xfree(majorminor);
+    }
+#else
         c->dl_search_path = pa_xstrdup(PA_DLSEARCHPATH);
+#endif

     return c;
 }

Maarten



More information about the pulseaudio-discuss mailing list