raster pushed a commit to branch master.
commit 2a7a3a557f1f5977a01b048ede95e7f3468a62c2
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date: Sun Apr 21 00:42:34 2013 +0900
e17 mixer - use XDG_RUNTIME_DIR for finding pulse... and have more
generous fallbacks.
---
src/modules/mixer/pa.c | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/src/modules/mixer/pa.c b/src/modules/mixer/pa.c
index a128662..a13b35e 100644
--- a/src/modules/mixer/pa.c
+++ b/src/modules/mixer/pa.c
@@ -713,13 +713,37 @@ pulse_new(void)
if (!prev)
{
struct stat st;
- buf = eina_stringshare_add(STATEDIR "/run/pulse/native");
- if (stat(buf, &st))
+ char *s;
+
+ s = getenv("XDG_RUNTIME_DIR");
+ buf = eina_stringshare_add(s);
+ if ((!s) || ((buf) && (stat(buf, &st))))
{
- INF("could not locate local socket '%s'!", buf);
- free(conn);
- return NULL;
+ snprintf(h, sizeof(h), "/run/user/%i/pulse/native",
+ (int)getuid());
+ if (stat(h, &st))
+ {
+ snprintf(h, sizeof(h), "%s/run/user/%i/pulse/native",
+ STATEDIR, (int)getuid());
+ if (stat(h, &st))
+ {
+ buf = eina_stringshare_add(STATEDIR
"/run/pulse/native");
+ if (stat(buf, &st))
+ {
+ eina_stringshare_del(buf);
+ INF("could not locate local socket '%s'!", buf);
+ free(conn);
+ return NULL;
+ }
+ }
+ else
+ buf = eina_stringshare_add(h);
+ }
+ else
+ buf = eina_stringshare_add(h);
}
+ else
+ buf = eina_stringshare_add(h);
conn->socket = buf;
}
else conn->socket = prev;
--
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter