Improved some cd-*.ps1 scripts

This commit is contained in:
Markus Fleschutz
2025-04-23 13:22:05 +02:00
parent 257c2c3d82
commit c35fcd8ea0
8 changed files with 39 additions and 25 deletions

View File

@ -13,13 +13,16 @@
#>
try {
if ($IsLinux) {
if ($IsLinux -or $IsMacOS) {
if (-not(Test-Path "~/Desktop" -pathType container)) {
throw "No 📂Desktop folder in your home directory yet"
}
$path = Resolve-Path "~/Desktop"
} else {
$path = [Environment]::GetFolderPath('DesktopDirectory')
}
if (-not(Test-Path "$path" -pathType container)) {
throw "No desktop folder at 📂$path"
if (-not(Test-Path "$path" -pathType container)) {
throw "No desktop folder at 📂$path yet"
}
}
Set-Location "$path"
"📂$path"