Skip to content

Commit 5b65686

Browse files
authored
Merge pull request #1974 from Borgquite/fixcoredetect
2 parents 718c753 + 0706243 commit 5b65686

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/code/Utils.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,15 +1207,14 @@ private static string GetHomeOrCreateTempHome()
12071207
return s_tempHome;
12081208
}
12091209

1210-
private readonly static Version PSVersion6 = new Version(6, 0);
12111210
private static void GetStandardPlatformPaths(
12121211
PSCmdlet psCmdlet,
12131212
out string localUserDir,
12141213
out string allUsersDir)
12151214
{
12161215
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
12171216
{
1218-
string powerShellType = (psCmdlet.Host.Version >= PSVersion6) ? "PowerShell" : "WindowsPowerShell";
1217+
string powerShellType = ((psCmdlet.GetVariableValue("PSEdition") as string) == "Core") ? "PowerShell" : "WindowsPowerShell";
12191218
localUserDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), powerShellType);
12201219
allUsersDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), powerShellType);
12211220
}
@@ -1235,7 +1234,7 @@ private static void GetStandardPlatformPaths(
12351234

12361235
public static bool GetIsWindowsPowerShell(PSCmdlet psCmdlet)
12371236
{
1238-
return psCmdlet.Host.Version < PSVersion6;
1237+
return ((psCmdlet.GetVariableValue("PSEdition") as string) != "Core");
12391238
}
12401239

12411240
/// <summary>

0 commit comments

Comments
 (0)