[alsa-devel] [PATCH (alsa-tools)] hdajackretask: Fix killing PulseAudio on newer PulseAudio versions

David Henningsson david.henningsson at canonical.com
Thu Jun 13 16:26:43 CEST 2013


The standard configuration directory for PulseAudio has changed,
I think since 3.0. Adjust the directory lookup mechanism to match.

Signed-off-by: David Henningsson <david.henningsson at canonical.com>
---
 hdajackretask/apply-changes.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/hdajackretask/apply-changes.c b/hdajackretask/apply-changes.c
index eda404e..77563f7 100644
--- a/hdajackretask/apply-changes.c
+++ b/hdajackretask/apply-changes.c
@@ -97,7 +97,20 @@ gboolean run_sudo_script(const gchar* script_name, GError** err)
 
 static gchar* get_pulseaudio_client_conf()
 {
-    return g_strdup_printf("%s/.pulse/client.conf", g_get_home_dir());
+    /* Reference: See src/pulsecore/core-util.c in pulseaudio */
+    gchar* fname;
+    gchar* dir = g_strdup_printf("%s/.pulse", g_get_home_dir());
+    if (access(dir, F_OK) < 0) {
+        const gchar* xch = g_getenv("XDG_CONFIG_HOME");
+        g_free(dir);
+        if (xch)
+            dir = g_strdup_printf("%s/pulse", xch);
+        else
+            dir = g_strdup_printf("%s/.config/pulse", g_get_home_dir());
+    }
+    fname = g_strdup_printf("%s/client.conf", dir);
+    g_free(dir);
+    return fname;
 }
 
 static gboolean kill_pulseaudio(gboolean* was_killed, int card, GError** err)
-- 
1.7.9.5



More information about the Alsa-devel mailing list