mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-31 13:57:26 -08:00
parent
288d0ea858
commit
dd5bc77576
|
@ -3,6 +3,9 @@ if ($null -ne (Get-Module -Name "oh-my-posh-core")) {
|
|||
Remove-Module -Name "oh-my-posh-core" -Force
|
||||
}
|
||||
|
||||
# enable the fallback for non-existing folders
|
||||
$env:POSH_UNKNOWN_DIR_REDIRECT = $true
|
||||
|
||||
# Helper functions which need to be defined before the module is loaded
|
||||
# See https://github.com/JanDeDobbeleer/oh-my-posh/discussions/2300
|
||||
function global:Get-PoshStackCount {
|
||||
|
@ -85,7 +88,7 @@ New-Module -Name "oh-my-posh-core" -ScriptBlock {
|
|||
if ($PWD.Provider.Name -eq 'FileSystem') {
|
||||
# make sure we're in a valid directory
|
||||
# if not, go back HOME
|
||||
if (-not (Test-Path -Path $PWD)) {
|
||||
if (-not (Test-Path -Path $PWD) -and $env:POSH_UNKNOWN_DIR_REDIRECT -eq $true) {
|
||||
Write-Host "Unable to find the current directory, falling back to $HOME" -ForegroundColor Red
|
||||
Set-Location $HOME
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue