forked from enlightenment/enlightenment
force people to do things right and use enlightenment_start
SVN revision: 26726
This commit is contained in:
parent
621a58de48
commit
3367599150
|
@ -337,6 +337,18 @@ main(int argc, char **argv)
|
|||
_e_main_shutdown(-1);
|
||||
}
|
||||
_e_main_shutdown_push(e_alert_shutdown);
|
||||
|
||||
/* we want to have been launched by enlightenment_start. there is a very */
|
||||
/* good reason we want to have been launched this way, thus check */
|
||||
if (!getenv("E_START"))
|
||||
{
|
||||
e_alert_show("You are executing enlightenment directly. This is bad. Please do not execute the\n"
|
||||
"\"enlightenment\" binary. Use the \"enlightenment_start\" launcher. It will\n"
|
||||
"handle setting up environment variables, paths, and launching any other required\n"
|
||||
"services etc. before enlightenment itself begins running.\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (!e_xinerama_init())
|
||||
{
|
||||
e_error_message_show(_("Enlightenment cannot setup xinerama wrapping.\n"
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "config.h"
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
|
||||
static void env_set(const char *var, const char *val);
|
||||
static int prefix_determine(char *argv0);
|
||||
|
@ -15,8 +18,9 @@ env_set(const char *var, const char *val)
|
|||
#ifdef HAVE_SETENV
|
||||
setenv(var, val, 1);
|
||||
#else
|
||||
char buf[8192];
|
||||
char *buf;
|
||||
|
||||
buf = alloca(strlen(var) + 1 + strlen(val) + 1);
|
||||
snprintf(buf, sizeof(buf), "%s=%s", var, val);
|
||||
if (getenv(var))
|
||||
putenv(buf);
|
||||
|
@ -248,31 +252,29 @@ int
|
|||
main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
char buf[16384];
|
||||
char **args;
|
||||
char *p;
|
||||
char buf[16384], **args, *p;
|
||||
|
||||
prefix_determine(argv[0]);
|
||||
|
||||
env_set("E_START", argv[0]);
|
||||
|
||||
p = getenv("PATH");
|
||||
if (p)
|
||||
snprintf(buf, sizeof(buf), "%s/bin:%s", _prefix_path, p);
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%s/bin", _prefix_path);
|
||||
if (p) snprintf(buf, sizeof(buf), "%s/bin:%s", _prefix_path, p);
|
||||
else snprintf(buf, sizeof(buf), "%s/bin", _prefix_path);
|
||||
env_set("PATH", buf);
|
||||
|
||||
p = getenv("LD_LIBRARY_PATH");
|
||||
if (p)
|
||||
snprintf(buf, sizeof(buf), "%s/lib:%s", _prefix_path, p);
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "%s/lib", _prefix_path);
|
||||
if (p) snprintf(buf, sizeof(buf), "%s/lib:%s", _prefix_path, p);
|
||||
else snprintf(buf, sizeof(buf), "%s/lib", _prefix_path);
|
||||
env_set("LD_LIBRARY_PATH", buf);
|
||||
|
||||
args = malloc((argc + 1) * sizeof(char *));
|
||||
args = alloca((argc + 1) * sizeof(char *));
|
||||
args[0] = "enlightenment";
|
||||
for (i = 1; i < argc; i++)
|
||||
args[i] = argv[i];
|
||||
for (i = 1; i < argc; i++) args[i] = argv[i];
|
||||
args[i] = NULL;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/bin/enlightenment", _prefix_path);
|
||||
return execv(buf, args);
|
||||
execv(buf, args);
|
||||
perror("execv");
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue