From c8efe1f4ecc01507ef44efc16b5ede4add050525 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Wed, 28 Dec 2022 15:24:29 +0100 Subject: [PATCH] Update cd-home.ps1 and list-workdir.ps1 --- Scripts/cd-home.ps1 | 14 +++++++------- Scripts/list-workdir.ps1 | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Scripts/cd-home.ps1 b/Scripts/cd-home.ps1 index f41c1bd6..e2b34d4d 100755 --- a/Scripts/cd-home.ps1 +++ b/Scripts/cd-home.ps1 @@ -1,6 +1,6 @@ <# .SYNOPSIS - Sets the working directory to the user's home directory + Sets the working directory to the user's home folder .DESCRIPTION This PowerShell script changes the working directory to the user's home directory. .EXAMPLE @@ -13,13 +13,13 @@ #> try { - $Path = Resolve-Path "$HOME" - if (-not(Test-Path "$Path" -pathType container)) { - throw "Home directory at 📂$Path doesn't exist (yet)" + $Path = Resolve-Path -Path "~" + if (Test-Path "$Path" -pathType container) { + Set-Location "$Path" + "📂$Path" + exit 0 # success } - Set-Location "$Path" - "📂$Path" - exit 0 # success + throw "User's home folder at 📂$Path doesn't exist (yet)" } catch { "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" exit 1 diff --git a/Scripts/list-workdir.ps1 b/Scripts/list-workdir.ps1 index 50c514db..b29536e8 100755 --- a/Scripts/list-workdir.ps1 +++ b/Scripts/list-workdir.ps1 @@ -13,7 +13,7 @@ #> try { - $Path = Resolve-Path "$PWD" + $Path = Resolve-Path -Path "$PWD" "📂$Path" exit 0 # success } catch {