quicklaunch: use xdg abstraction instead of direct env var

Summary:
there are defined ways what should happen in XDG_RUNTIME_DIR is not
defined, eina_vpath is the abstraction for doing this.

This ensures that the socket is created in the correct directory.

Depends on D6744

Reviewers: zmike, stefan_schmidt

Reviewed By: zmike

Subscribers: #reviewers, cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6745
This commit is contained in:
Marcel Hollerbach 2018-08-20 12:58:23 -04:00 committed by Mike Blumenkrantz
parent 7968a0d0b9
commit 77ce62e1d2
1 changed files with 2 additions and 5 deletions

View File

@ -182,7 +182,6 @@ main(int argc, char **argv)
char buf[PATH_MAX];
struct sigaction action;
const char *domain;
char *rundir;
int ret = 0;
if (!eina_init())
@ -204,9 +203,7 @@ main(int argc, char **argv)
if (!domain) domain = getenv("DISPLAY");
if (!domain) domain = "unknown";
}
rundir = getenv("XDG_RUNTIME_DIR");
if (!rundir) rundir = "/tmp";
snprintf(buf, sizeof(buf), "%s/elm-ql-%i", rundir, getuid());
eina_vpath_resolve_snprintf(buf, sizeof(buf), "(:usr.run:)/elm-ql-%i", getuid());
if (stat(buf, &st) < 0)
{
ret = mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR);
@ -216,7 +213,7 @@ main(int argc, char **argv)
exit(-1);
}
}
snprintf(buf, sizeof(buf), "%s/elm-ql-%i/%s", rundir, getuid(), domain);
eina_vpath_resolve_snprintf(buf, sizeof(buf), "(:usr.run:)/elm-ql-%i/%s", getuid(), domain);
unlink(buf);
sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (sock < 0)