From 860a6462e5362fab44a2e5471faf5c65b2135ce6 Mon Sep 17 00:00:00 2001 From: Iristyle Date: Thu, 9 May 2013 14:07:53 -0400 Subject: [PATCH] feat: Posh-GitHub / VsVars $PROFILE encoding - function taken from posh-github, allow us to reliably select the appropriate encoding for writing to $PROFILE --- Posh-GitHub/Posh-GitHub.nuspec | 1 + Posh-GitHub/tools/chocolateyInstall.ps1 | 3 ++- Posh-VsVars/Posh-VsVars.nuspec | 1 + Posh-VsVars/tools/chocolateyInstall.ps1 | 3 ++- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Posh-GitHub/Posh-GitHub.nuspec b/Posh-GitHub/Posh-GitHub.nuspec index d85f0b3..26c3223 100644 --- a/Posh-GitHub/Posh-GitHub.nuspec +++ b/Posh-GitHub/Posh-GitHub.nuspec @@ -48,5 +48,6 @@ that have been merged into the master branch. + diff --git a/Posh-GitHub/tools/chocolateyInstall.ps1 b/Posh-GitHub/tools/chocolateyInstall.ps1 index a6682c9..a8c0bf7 100644 --- a/Posh-GitHub/tools/chocolateyInstall.ps1 +++ b/Posh-GitHub/tools/chocolateyInstall.ps1 @@ -10,6 +10,7 @@ function Get-CurrentDirectory try { $current = Get-CurrentDirectory . (Join-Path $current 'PowerShellHelpers.ps1') + . (Join-Path $current 'EncodingHelpers.ps1') # find user specific module directory $moduleDirectory = Get-ModuleDirectory @@ -57,7 +58,7 @@ try { { $loaderFile = 'Posh-GitHub-Profile.ps1' "`n`n# Load Posh-GitHub`n. '$installDirectory\$loaderFile'" | - Out-File -FilePath $PROFILE -Append -Encoding UTF8 + Out-File -FilePath $PROFILE -Append -Encoding (Get-FileEncoding $PROFILE) . $PROFILE } diff --git a/Posh-VsVars/Posh-VsVars.nuspec b/Posh-VsVars/Posh-VsVars.nuspec index fbf527e..fe98e0c 100644 --- a/Posh-VsVars/Posh-VsVars.nuspec +++ b/Posh-VsVars/Posh-VsVars.nuspec @@ -39,5 +39,6 @@ http://www.hanselman.com/blog/AwesomeVisualStudioCommandPromptAndPowerShellIcons + diff --git a/Posh-VsVars/tools/chocolateyInstall.ps1 b/Posh-VsVars/tools/chocolateyInstall.ps1 index 5b7abc8..e93c3b3 100644 --- a/Posh-VsVars/tools/chocolateyInstall.ps1 +++ b/Posh-VsVars/tools/chocolateyInstall.ps1 @@ -9,6 +9,7 @@ function Get-CurrentDirectory try { $current = Get-CurrentDirectory . (Join-Path $current 'PowerShellHelpers.ps1') + . (Join-Path $current 'EncodingHelpers.ps1') $moduleDirectory = Get-ModuleDirectory $installDirectory = Join-Path $moduleDirectory $package @@ -56,7 +57,7 @@ try { { $loaderFile = 'Posh-VsVars-Profile.ps1' "`n`n# Load Posh-VsVars`n. '$installDirectory\$loaderFile'" | - Out-File -FilePath $PROFILE -Append -Encoding UTF8 + Out-File -FilePath $PROFILE -Append -Encoding (Get-FileEncoding $PROFILE) Write-Host 'Reloading PowerShell Profile...' . $PROFILE }