mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-02 05:41:10 -08:00
fix: powershell exports config files as utf8 without BOM
This commit is contained in:
parent
37e96de87e
commit
90cd37e516
|
@ -89,10 +89,15 @@ function Export-PoshTheme {
|
|||
|
||||
$config = $global:PoshSettings.Theme
|
||||
$poshCommand = Get-PoshCommand
|
||||
# Save current encoding and swap for UTF8
|
||||
|
||||
# Save current encoding and swap for UTF8 without BOM
|
||||
$originalOutputEncoding = [Console]::OutputEncoding
|
||||
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
||||
& $poshCommand -config $config -print-config | Out-File -FilePath $FilePath
|
||||
[Console]::OutputEncoding = [Text.UTF8Encoding]::new($false)
|
||||
|
||||
# Create Config File
|
||||
$configString = & $poshCommand -config $config -print-config
|
||||
[IO.File]::WriteAllLines($FilePath, $configString)
|
||||
|
||||
# Restore initial encoding
|
||||
[Console]::OutputEncoding = $originalOutputEncoding
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue