fix: export-poshtheme issue with relative path

Path.GetFullPath used to resolve full or relative paths
This commit is contained in:
lnu 2021-05-28 06:24:51 +02:00 committed by Jan De Dobbeleer
parent 79fa990205
commit 46bdc4537d

View file

@ -148,12 +148,9 @@ function global:Export-PoshTheme {
$config = $global:PoshSettings.Theme
$omp = "::OMP::"
$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)
[IO.File]::WriteAllLines($FilePath, $configString)
}
else {