move xdg data dir fixup to e_start to esnure its set super-early

now everything e launched should agree on xdg data dir if hose os
doesn't set it (bad host os!) :)
This commit is contained in:
Carsten Haitzler 2020-01-16 10:38:54 +00:00
parent 7e47977d9a
commit 6373d5583b
2 changed files with 27 additions and 21 deletions

View File

@ -180,22 +180,7 @@ _xdg_data_dirs_augment(void)
e_util_env_set("XDG_CONFIG_DIRS", buf);
}
if (!getenv("XDG_RUNTIME_DIR"))
{
const char *dir;
snprintf(buf, sizeof(buf), "/tmp/xdg-XXXXXX");
dir = mkdtemp(buf);
if (!dir) dir = "/tmp";
else
{
char buf2[4096];
e_util_env_set("XDG_RUNTIME_DIR", dir);
snprintf(buf2, sizeof(buf2), "%s/.e-deleteme", dir);
ecore_file_mkdir(buf2);
}
}
// N.B. XDG_RUNTIME_DIR is taken care of in e_start
/* set menu prefix so we get our e menu */
if (!getenv("XDG_MENU_PREFIX"))
@ -331,6 +316,11 @@ main(int argc, char **argv)
if (!s) e_util_env_set("EINA_STATGEN", NULL);
_e_main_shutdown_push(eina_shutdown);
/* Eio's eio_init internally calls efreet_init. Set XDG_MENU_PREFIX here */
/* else efreet's efreet_menu_prefix symbol is set erroneously during eio_init. */
_xdg_data_dirs_augment();
if (!e_log_init())
{
e_error_message_show(_("Enlightenment could not create a logging domain!\n"));
@ -423,10 +413,6 @@ main(int argc, char **argv)
TS("EFX Init Done");
_e_main_shutdown_push((void*)e_efx_shutdown);
/* Eio's eio_init internally calls efreet_init. Set XDG_MENU_PREFIX here */
/* else efreet's efreet_menu_prefix symbol is set erroneously during eio_init. */
_xdg_data_dirs_augment();
TS("EIO Init");
if (!eio_init())
{

View File

@ -558,9 +558,10 @@ main(int argc, char **argv)
char buf[8192], buf2[4096], **args, *home;
char valgrind_path[PATH_MAX] = "";
const char *valgrind_log = NULL;
const char *bindir;
const char *bindir, *s;
Eina_Bool really_know = EINA_FALSE;
struct sigaction action;
struct stat st;
pid_t child = -1;
Eina_Bool restart = EINA_TRUE;
@ -584,6 +585,25 @@ main(int argc, char **argv)
sigemptyset(&action.sa_mask);
sigaction(SIGHUP, &action, NULL);
s = getenv("XDG_RUNTIME_DIR");
if ((!s) || (stat(s, &st) != 0) || (!S_ISDIR(st.st_mode)))
{
const char *dir;
snprintf(buf, sizeof(buf), "/tmp/xdg-XXXXXX");
dir = mkdtemp(buf);
if (!dir) dir = "/tmp";
else
{
FILE *f;
snprintf(buf2, sizeof(buf2), "%s/.e-deleteme", dir);
f = fopen(buf2, "w");
if (f) fclose(f);
}
env_set("XDG_RUNTIME_DIR", dir);
}
eina_init();
/* reexcute myself with dbus-launch if dbus-launch is not running yet */