From ebfd03936b7092e0dc20a68358535fb6d2726850 Mon Sep 17 00:00:00 2001 From: Jake Bolton Date: Sat, 29 Jul 2023 18:37:32 -0500 Subject: [PATCH] misc updates --- public_autoloader/Test-IsDirectory.ps1 | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/public_autoloader/Test-IsDirectory.ps1 b/public_autoloader/Test-IsDirectory.ps1 index 104342d..80a21f7 100644 --- a/public_autoloader/Test-IsDirectory.ps1 +++ b/public_autoloader/Test-IsDirectory.ps1 @@ -6,18 +6,17 @@ $script:publicToExport.alias += @( 'Test-IsDirectory' ) - function Test-IsContainer { <#c .Synopsis - Is it a directory, or other container type??' + Is it a directory, or other container type?' .example PS> Test-IsDirectory '.' # $True PS> Test-IsDirectory 'foo.png' # $False - Todo: see: > + Todo: see: > foreach ($item in $pathList) { $extraArgs = ($item = Get-Item $Path -ea 0) -and $item.PSIsContainer | ?? { '' } : { '-r' } & $code $pathList $extraArgs @@ -42,30 +41,21 @@ function Test-IsContainer { begin { } process { - <# - #> $InputObject | ForEach-Object { + $TargetItem = $_ if ($Null -eq $_) { - return $false + return $false } - $TargetItem = $_ $item = Get-Item $TargetItem -ea ignore if ( [string]::IsNullOrEmpty( $TargetItem )) { - return $false; + return $false } if ($null -eq $item) { return $false } if ($IsContainer -and $Item.PSIsContainer) { - return $True; + return $True } - # try { - # $item = Get-Item $TargetItem -ea stop - # } catch { - # # definitely didn't exist - # Write-Debug 'GI failed' - # return $false; - # } $isType = $Item -is 'System.IO.DirectoryInfo' $meta = @{ IsDirInfo = $isDir