Don't add common or excluded directories to the db

This commit is contained in:
2021-05-19 01:37:50 -04:00
parent f49f3eb002
commit 0e66511c17

10
z.ps1
View File

@@ -83,11 +83,15 @@ function Add-ToZDatabase {
$Add += "\"; $Add += "\";
} }
# Check so we don't match $HOME # Check so we don't match $HOME. The logic here (I think) is that it's
if ($Add -eq $env:HOME) { return $null; } # already easy to jump to home with ~, we don't need another shortcut.
if (($Add -eq $env:HOME) -or ($Add -eq $env:USERPROFILE)) {
Set-Location -Path $Add; return;
}
# Don't track excluded directories # Don't track excluded directories
if (($env:_Z_EXCLUDE_DIRS -ne $null) -and ($env:_Z_EXCLUDE_DIRS -contains $Add)) { if (($null -ne $env:_Z_EXCLUDE_DIRS) -and ($env:_Z_EXCLUDE_DIRS -contains $Add)) {
Set-Location -Path $Add;
return; return;
} }