append, not prepend e's prefix bin/lib instead of prepend.

SVN revision: 73847
This commit is contained in:
Carsten Haitzler 2012-07-14 10:04:52 +00:00
parent fff2214391
commit b1141b5d53
1 changed files with 72 additions and 35 deletions

View File

@ -115,6 +115,76 @@ EAPI Eina_Bool starting = EINA_TRUE;
EAPI Eina_Bool stopping = EINA_FALSE;
EAPI Eina_Bool restart = EINA_FALSE;
/*
static void
_env_path_prepend(const char *env, const char *path)
{
char *p, *p2, *s;
int len = 0, len2 = 0;
p = getenv(env);
if (p) len = strlen(p);
p2 = (char *)path;
if (p2) len2 = strlen(p2);
if (p && p2)
{
// path already there at the start. dont prepend. :)
if ((!strcmp(p, p2)) ||
((len > len2) &&
(!strncmp(p, p2, len2)) &&
(p[len2] == ':')))
return;
}
s = malloc(len + 1 + len2 + 1);
if (s)
{
s[0] = 0;
if (p2)
{
strcat(s, p2);
strcat(s, ":");
}
strcat(s, p);
e_util_env_set(env, s);
free(s);
}
}
*/
static void
_env_path_append(const char *env, const char *path)
{
char *p, *p2, *s;
int len = 0, len2 = 0;
p = getenv(env);
if (p) len = strlen(p);
p2 = (char *)path;
if (p2) len2 = strlen(p2);
if (p && p2)
{
// path already there at the end. dont append. :)
if ((!strcmp(p, p2)) ||
((len > len2) &&
(!strcmp((p + len - len2), p2)) &&
(p[len - len2 - 1] == ':')))
return;
}
s = malloc(len + 1 + len2 + 1);
if (s)
{
s[0] = 0;
strcat(s, p);
if (p2)
{
strcat(s, ":");
strcat(s, p2);
}
e_util_env_set(env, s);
free(s);
}
}
static void
_xdg_data_dirs_augment(void)
{
@ -140,39 +210,6 @@ _xdg_data_dirs_augment(void)
}
}
static void
_env_path_prepend(const char *env, const char *path)
{
char *p, *p2, *s;
int len = 0, len2 = 0;
p = getenv(env);
if (p) len = strlen(p);
p2 = (char *)path;
if (p2) len2 = strlen(p2);
if (p && p2)
{
// path already there at the start. dont prepend. :)
if ((!strncmp(p, p2, strlen(p2))) &&
(len > len2) &&
(p[len2] == ':'))
return;
}
s = malloc(len + 1 + len2 + 1);
if (s)
{
s[0] = 0;
if (p) strcat(s, p);
if (p2)
{
strcat(s, ":");
strcat(s, p2);
}
e_util_env_set(env, s);
free(s);
}
}
static void
_fix_user_default_edj(void)
{
@ -278,8 +315,8 @@ main(int argc, char **argv)
}
TS("Determine Prefix Done");
_env_path_prepend("PATH", e_prefix_bin_get());
_env_path_prepend("LD_LIBRARY_PATH", e_prefix_lib_get());
_env_path_append("PATH", e_prefix_bin_get());
_env_path_append("LD_LIBRARY_PATH", e_prefix_lib_get());
/* for debugging by redirecting stdout of e to a log file to tail */
setvbuf(stdout, NULL, _IONBF, 0);