Commit 996baf63 authored by Alexandre Julliard's avatar Alexandre Julliard

Transmit the Windows PATH to child processes using the WINEPATH

variable.
parent 6ac4da7e
......@@ -160,17 +160,21 @@ int DIR_Init(void)
DRIVE_Chdir( drive, DIR_Windows.short_name + 2 );
}
PROFILE_GetWineIniString(wineW, pathW, path_dirW, longpath, MAX_PATHNAME_LEN);
if (strchrW(longpath, '/'))
/* Set the environment variables */
/* set PATH only if not set already */
if (!GetEnvironmentVariableW( path_capsW, longpath, MAX_PATHNAME_LEN ))
{
MESSAGE("Fix your wine config to use DOS drive syntax in [wine] 'Path=' statement! (no '/' allowed)\n");
PROFILE_UsageWineIni();
ExitProcess(1);
PROFILE_GetWineIniString(wineW, pathW, path_dirW, longpath, MAX_PATHNAME_LEN);
if (strchrW(longpath, '/'))
{
MESSAGE("Fix your wine config to use DOS drive syntax in [wine] 'Path=' statement! (no '/' allowed)\n");
PROFILE_UsageWineIni();
ExitProcess(1);
}
SetEnvironmentVariableW( path_capsW, longpath );
}
/* Set the environment variables */
SetEnvironmentVariableW( path_capsW, longpath );
SetEnvironmentVariableW( temp_capsW, tmp_dir.short_name );
SetEnvironmentVariableW( tmp_capsW, tmp_dir.short_name );
SetEnvironmentVariableW( windirW, DIR_Windows.short_name );
......
......@@ -152,7 +152,11 @@ static BOOL build_environment(void)
/* Compute the total size of the Unix environment */
size = sizeof(BYTE) + sizeof(WORD) + sizeof(ENV_program_name);
for (e = environ; *e; e++) size += strlen(*e) + 1;
for (e = environ; *e; e++)
{
if (!memcmp( *e, "PATH=", 5 )) continue;
size += strlen(*e) + 1;
}
/* Now allocate the environment */
......@@ -164,7 +168,10 @@ static BOOL build_environment(void)
for (e = environ; *e; e++)
{
strcpy( p, *e );
/* skip Unix PATH and store WINEPATH as PATH */
if (!memcmp( *e, "PATH=", 5 )) continue;
if (!memcmp( *e, "WINEPATH=", 9 )) strcpy( p, *e + 4 );
else strcpy( p, *e );
p += strlen(p) + 1;
}
......
......@@ -820,9 +820,16 @@ static char **build_envp( const char *env, const char *extra_env )
/* now put the Windows environment strings */
for (p = env; *p; p += strlen(p) + 1)
{
if (memcmp( p, "PATH=", 5 ) &&
memcmp( p, "HOME=", 5 ) &&
memcmp( p, "WINEPREFIX=", 11 )) *envptr++ = (char *)p;
if (!memcmp( p, "PATH=", 5 )) /* store PATH as WINEPATH */
{
char *winepath = malloc( strlen(p) + 5 );
strcpy( winepath, "WINE" );
strcpy( winepath + 4, p );
*envptr++ = winepath;
}
else if (memcmp( p, "HOME=", 5 ) &&
memcmp( p, "WINEPATH=", 9 ) &&
memcmp( p, "WINEPREFIX=", 11 )) *envptr++ = (char *)p;
}
*envptr = 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment