Remove 'oldPowershellExeName' and 'oldPowershellDepsName' (#5408)

This commit is contained in:
Dongbo Wang 2017-12-06 12:37:41 -08:00 committed by Travis Plunk
parent 964e6aff47
commit d4e802148c

View File

@ -769,13 +769,10 @@ namespace System.Management.Automation
{
#if UNIX
const string powershellExeName = "pwsh";
const string oldPowershellExeName = "powershell";
#else
const string powershellExeName = "pwsh.exe";
const string oldPowershellExeName = "powershell.exe";
#endif
const string powershellDepsName = "pwsh.deps.json";
const string oldPowershellDepsName = "powershell.deps.json";
StringBuilder modulePathString = new StringBuilder(currentProcessModulePath.Length);
char[] invalidPathChars = Path.GetInvalidPathChars();
@ -796,10 +793,8 @@ namespace System.Management.Automation
{
string parentDir = Path.GetDirectoryName(trimedPath);
string psExePath = Path.Combine(parentDir, powershellExeName);
string oldExePath = Path.Combine(parentDir, oldPowershellExeName);
string psDepsPath = Path.Combine(parentDir, powershellDepsName);
string oldDepsPath = Path.Combine(parentDir, oldPowershellDepsName);
if ((File.Exists(psExePath) && File.Exists(psDepsPath)) || (File.Exists(oldExePath) && File.Exists(oldDepsPath)))
if ((File.Exists(psExePath) && File.Exists(psDepsPath)))
{
// Path is a PSHome module path from a different powershell core instance. Ignore it.
continue;