Transmit the Windows PATH to child processes using the WINEPATH

variable.
This commit is contained in:
Alexandre Julliard 2002-10-09 18:35:01 +00:00
parent 6ac4da7efb
commit 996baf6379
3 changed files with 32 additions and 14 deletions

View File

@ -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, '/'))
{
MESSAGE("Fix your wine config to use DOS drive syntax in [wine] 'Path=' statement! (no '/' allowed)\n");
PROFILE_UsageWineIni();
ExitProcess(1);
}
/* Set the environment variables */
SetEnvironmentVariableW( path_capsW, longpath );
/* set PATH only if not set already */
if (!GetEnvironmentVariableW( path_capsW, longpath, MAX_PATHNAME_LEN ))
{
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 );
}
SetEnvironmentVariableW( temp_capsW, tmp_dir.short_name );
SetEnvironmentVariableW( tmp_capsW, tmp_dir.short_name );
SetEnvironmentVariableW( windirW, DIR_Windows.short_name );

View File

@ -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;
}

View File

@ -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;
}