Skip to content

Commit 140d452

Browse files
committed
Fix PSReadLine history path on Windows
Bug introduced in initial port of PSReadLine. `Path.Combine` sees the initial backslash as an absolute path, thus discarding `AppData`.
1 parent a293707 commit 140d452

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Microsoft.PowerShell.PSReadLine/Cmdlets.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ public PSConsoleReadlineOptions(string hostName)
172172
#if CORECLR
173173
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) // MS Windows
174174
{
175-
HistorySavePath = System.IO.Path.Combine(Environment.ExpandEnvironmentVariables("%AppData%"),
176-
@"\Microsoft\Windows\PowerShell\PSReadline\",
175+
HistorySavePath = System.IO.Path.Combine(Environment.GetEnvironmentVariable("APPDATA"),
176+
@"Microsoft\Windows\PowerShell\PSReadline\",
177177
hostName + "_history.txt");
178178
}
179179

0 commit comments

Comments
 (0)