e17 mixer - use XDG_RUNTIME_DIR for finding pulse... and have more

generous fallbacks.
This commit is contained in:
Carsten Haitzler 2013-04-21 00:42:34 +09:00
parent 0985de0051
commit 2a7a3a557f
1 changed files with 29 additions and 5 deletions

View File

@ -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;