Skip to content
Open
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
5 changes: 2 additions & 3 deletions src/code/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1161,15 +1161,14 @@ private static string GetHomeOrCreateTempHome()
return s_tempHome;
}

private readonly static Version PSVersion6 = new Version(6, 0);
private static void GetStandardPlatformPaths(
PSCmdlet psCmdlet,
out string localUserDir,
out string allUsersDir)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
string powerShellType = (psCmdlet.Host.Version >= PSVersion6) ? "PowerShell" : "WindowsPowerShell";
string powerShellType = ((psCmdlet.GetVariableValue("PSEdition") as string) == "Core") ? "PowerShell" : "WindowsPowerShell";
localUserDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), powerShellType);
allUsersDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), powerShellType);
}
Expand All @@ -1189,7 +1188,7 @@ private static void GetStandardPlatformPaths(

public static bool GetIsWindowsPowerShell(PSCmdlet psCmdlet)
{
return psCmdlet.Host.Version < PSVersion6;
return ((psCmdlet.GetVariableValue("PSEdition") as string) != "Core");
}

/// <summary>
Expand Down