Clean up PSMODULEPATH Windows work-around

This commit is contained in:
Andrew Schwartzmeyer
2016-07-26 11:49:54 -07:00
parent cf8ddc10d6
commit d40131ae44
2 changed files with 15 additions and 14 deletions
@@ -778,12 +778,13 @@ namespace System.Management.Automation
{
// Now handle the case where the environment variable is already set.
// Porting note: Open PowerShell has a Modules folder in the the application base path which contains the built-in modules
// It must be in the front of the path no matter what.
if (Platform.IsCore)
{
currentProcessModulePath = AddToPath(currentProcessModulePath, GetSystemwideModulePath(), 0);
}
// CoreCLR PowerShell on Windows has a Modules folder in the the application base
// path which contains the built-in modules It must be in the front of the path no
// matter what, regardless of inherited path.
#if CORECLR && !UNIX
// TODO: #1184 will resolve this work-around
currentProcessModulePath = AddToPath(currentProcessModulePath, GetSystemwideModulePath(), 0);
#endif
// If there is no personal path key, then if the env variable doesn't match the system variable,
// the user modified it somewhere, else prepend the default personel module path
@@ -296,14 +296,14 @@ namespace System.Management.Automation
// And built-in modules
string progFileDir;
if (Platform.IsCore)
{
progFileDir = Path.Combine(appBase, "Modules");
}
else
{
progFileDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "WindowsPowerShell", "Modules");
}
// TODO: #1184 will resolve this work-around
// Side-by-side versions of PowerShell use modules from their application base, not
// the system installation path.
#if CORECLR
progFileDir = Path.Combine(appBase, "Modules");
#else
progFileDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "WindowsPowerShell", "Modules");
#endif
if (!string.IsNullOrEmpty(progFileDir))
{