Skip to content

oh-my-posh doesn't load / profile not loaded correctly #198

@erbkaiser

Description

@erbkaiser

Details

If the Documents folder is in OneDrive, the CTT profile is not able to load the proper Oh-My-Posh config and returns an error. Probably also happens for Powershell 5 now (untested).

Suggested fix based on old version:

line 3 onwards

function Get-ProfileDir {
if ($PSVersionTable.PSEdition -eq "Core") {
return [Environment]::GetFolderPath("MyDocuments") + "\PowerShell"
} elseif ($PSVersionTable.PSEdition -eq "Desktop") {
return [Environment]::GetFolderPath("MyDocuments") + "\WindowsPowerShell"
} else {
Write-Error "Unsupported PowerShell edition: $($PSVersionTable.PSEdition)"
return $null
}
}
$profileDir = Get-ProfileDir
oh-my-posh init pwsh --config $profileDir\cobalt2.omp.json | Invoke-Expression

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions