From 7eae98f8d762d4bc80ea117d28d87792ac082592 Mon Sep 17 00:00:00 2001 From: lnu Date: Tue, 1 Jun 2021 05:57:41 +0200 Subject: [PATCH] fix(pwsh): use correct directory when exporting theme resolves #768 --- src/init/omp.ps1 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/init/omp.ps1 b/src/init/omp.ps1 index 7c1ce49b..deb97264 100644 --- a/src/init/omp.ps1 +++ b/src/init/omp.ps1 @@ -150,10 +150,8 @@ function global:Export-PoshTheme { $configString = @(&$omp --config="$config" --config-format="$Format" --print-config 2>&1) # if no path, copy to clipboard by default if ($FilePath -ne "") { - if ($FilePath.StartsWith('~')) { - $FilePath = $FilePath.Replace('~', $HOME) - } - $FilePath = [IO.Path]::GetFullPath($FilePath, (Get-Location -PSProvider FileSystem).ProviderPath) + #https://stackoverflow.com/questions/3038337/powershell-resolve-path-that-might-not-exist + $FilePath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($FilePath) [IO.File]::WriteAllLines($FilePath, $configString) } else {