From bfde55932fdefe3d6a9530dab69402f0f0afc66d Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Tue, 8 Nov 2022 21:02:45 +0100 Subject: [PATCH] Update cd-repos.ps1 --- Scripts/cd-repos.ps1 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Scripts/cd-repos.ps1 b/Scripts/cd-repos.ps1 index fc13d7dd..f2b5cd8f 100755 --- a/Scripts/cd-repos.ps1 +++ b/Scripts/cd-repos.ps1 @@ -5,7 +5,7 @@ This PowerShell script changes the working directory to the user's Git repositories folder. .EXAMPLE PS> ./cd-repos - 📂C:\Users\Markus\source\repos + 📂C:\Users\Markus\Repos .LINK https://github.com/fleschutz/PowerShell .NOTES @@ -13,12 +13,14 @@ #> try { - if ($IsLinux) { + if (Test-Path "$HOME/Repos" -pathType Container) { $Path = Resolve-Path "$HOME/Repos" - } else { + } elseif (Test-Path "$HOME/Repositories" -pathType Container) { + $Path = Resolve-Path "$HOME/Repositories" + } elseif (Test-Path "$HOME/source/repos" -pathType Container) { $Path = Resolve-Path "$HOME/source/repos" - } - if (-not(Test-Path "$Path" -pathType container)) { + } else { + $Path = "$HOME/Repos" throw "Folder for Git repositories at 📂$Path doesn't exist (yet)" } Set-Location "$Path"