Sets the current directory to the process directory at startup. This is to avoid a potential problem with embedding applications calling ShellExecute where the working directory parameter. This results in the new process inheriting the current working directory of the old process. See bug 202363. r=wtc@netscape.com, a=asa@mozilla.org

This commit is contained in:
dougt%meer.net 2003-05-08 18:42:15 +00:00
parent 44d9f9a8fb
commit 04fb8b72d8

View File

@ -487,6 +487,21 @@ nsGREDirServiceProvider::AddGRELocationToPath()
XPCOM_SEARCH_KEY,
grePath,
path);
#if XP_WIN32
// On windows, the current directory is searched before the
// PATH environment variable. This is a very bad thing
// since libraries in the cwd will be picked up before
// any that are in either the application or GRE directory.
char* cpd = GetGREDirectoryPath();
if (cpd) {
SetCurrentDirectory(cpd);
free (cpd);
}
#endif
PR_SetEnv(mPathEnvString);
free(grePath);
}