mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-25 09:23:12 +01:00
Update open-downloads-folder.ps1
This commit is contained in:
parent
10f409d2c8
commit
537d2b245a
@ -8,15 +8,19 @@
|
|||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz / License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$TargetDir = resolve-path "$HOME/Downloads"
|
if ($IsLinux) {
|
||||||
if (-not(test-path "$TargetDir" -pathType container)) {
|
$Path = Resolve-Path "$HOME/Downloads"
|
||||||
throw "Downloads folder at 📂$TargetDir doesn't exist (yet)"
|
} else {
|
||||||
|
$Path = (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path
|
||||||
}
|
}
|
||||||
& "$PSScriptRoot/open-file-explorer.ps1" "$TargetDir"
|
if (-not(Test-Path "$Path" -pathType container)) {
|
||||||
|
throw "Downloads folder at 📂$Path doesn't exist (yet)"
|
||||||
|
}
|
||||||
|
& "$PSScriptRoot/open-file-explorer.ps1" $Path
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user