Use temp personal path at Runspace startup when env 'HOME' not defined (#13239)

This commit is contained in:
Dongbo Wang 2020-07-23 10:24:42 -07:00 committed by GitHub
parent 6ca0024db9
commit cfb1952fd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -239,6 +239,8 @@ namespace System.Management.Automation
DEFAULT
}
private static string s_tempHomeDir = null;
/// <summary>
/// Function for choosing directory location of PowerShell for profile loading.
/// </summary>
@ -252,7 +254,8 @@ namespace System.Management.Automation
string envHome = System.Environment.GetEnvironmentVariable(CommonEnvVariableNames.Home);
if (envHome == null)
{
envHome = GetTemporaryDirectory();
s_tempHomeDir ??= GetTemporaryDirectory();
envHome = s_tempHomeDir;
}
string xdgConfigHomeDefault = Path.Combine(envHome, ".config", "powershell");