when process has not env, but future will, show the instruction (#8739)
This commit is contained in:
parent
2e7c5f123a
commit
495630fe97
1 changed files with 21 additions and 16 deletions
|
@ -40,10 +40,19 @@ namespace Microsoft.DotNet.ShellShim
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool PackageExecutablePathExists()
|
private bool PackageExecutablePathExists()
|
||||||
|
{
|
||||||
|
return PackageExecutablePathExistsForCurrentProcess() || PackageExecutablePathWillExistForFutureNewProcess();
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool PackageExecutablePathWillExistForFutureNewProcess()
|
||||||
{
|
{
|
||||||
return EnvironmentVariableConatinsPackageExecutablePath(Environment.GetEnvironmentVariable(PathName, EnvironmentVariableTarget.User))
|
return EnvironmentVariableConatinsPackageExecutablePath(Environment.GetEnvironmentVariable(PathName, EnvironmentVariableTarget.User))
|
||||||
|| EnvironmentVariableConatinsPackageExecutablePath(Environment.GetEnvironmentVariable(PathName, EnvironmentVariableTarget.Machine))
|
|| EnvironmentVariableConatinsPackageExecutablePath(Environment.GetEnvironmentVariable(PathName, EnvironmentVariableTarget.Machine));
|
||||||
|| EnvironmentVariableConatinsPackageExecutablePath(Environment.GetEnvironmentVariable(PathName, EnvironmentVariableTarget.Process));
|
}
|
||||||
|
|
||||||
|
private bool PackageExecutablePathExistsForCurrentProcess()
|
||||||
|
{
|
||||||
|
return EnvironmentVariableConatinsPackageExecutablePath(Environment.GetEnvironmentVariable(PathName, EnvironmentVariableTarget.Process));
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool EnvironmentVariableConatinsPackageExecutablePath(string environmentVariable)
|
private bool EnvironmentVariableConatinsPackageExecutablePath(string environmentVariable)
|
||||||
|
@ -58,21 +67,17 @@ namespace Microsoft.DotNet.ShellShim
|
||||||
|
|
||||||
public void PrintAddPathInstructionIfPathDoesNotExist()
|
public void PrintAddPathInstructionIfPathDoesNotExist()
|
||||||
{
|
{
|
||||||
if (!PackageExecutablePathExists())
|
if (!PackageExecutablePathExistsForCurrentProcess() && PackageExecutablePathWillExistForFutureNewProcess())
|
||||||
{
|
{
|
||||||
if (Environment.GetEnvironmentVariable(PathName, EnvironmentVariableTarget.User).Split(';')
|
_reporter.WriteLine(
|
||||||
.Contains(_packageExecutablePath))
|
CommonLocalizableStrings.EnvironmentPathWindowsNeedReopen);
|
||||||
{
|
}
|
||||||
_reporter.WriteLine(
|
else if (!PackageExecutablePathWillExistForFutureNewProcess())
|
||||||
CommonLocalizableStrings.EnvironmentPathWindowsNeedReopen);
|
{
|
||||||
}
|
_reporter.WriteLine(
|
||||||
else
|
string.Format(
|
||||||
{
|
CommonLocalizableStrings.EnvironmentPathWindowsManualInstructions,
|
||||||
_reporter.WriteLine(
|
_packageExecutablePath));
|
||||||
string.Format(
|
|
||||||
CommonLocalizableStrings.EnvironmentPathWindowsManualInstructions,
|
|
||||||
_packageExecutablePath));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue