Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ public enum XDG_Type
DEFAULT
}

private static string s_tempHomeDir = null;

/// <summary>
/// Function for choosing directory location of PowerShell for profile loading.
/// </summary>
Expand All @@ -252,7 +254,8 @@ public static string SelectProductNameForDirectory(Platform.XDG_Type dirpath)
string envHome = System.Environment.GetEnvironmentVariable(CommonEnvVariableNames.Home);
if (envHome == null)
{
envHome = GetTemporaryDirectory();
s_tempHomeDir ??= GetTemporaryDirectory();
envHome = s_tempHomeDir;
Comment on lines 254 to +258
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You assume that HOME could be defined on the fly (and preserve current behavior) but we could already put some files in previous folder :-(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry that I missed this comment. I think it would be very unlikely that the HOME env var changes it value after it's declared, so I'm not too worry about this.

}

string xdgConfigHomeDefault = Path.Combine(envHome, ".config", "powershell");
Expand Down