Skip to content

Commit

Permalink
misc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ninmonkey committed Jul 29, 2023
1 parent ee6d0e7 commit ebfd039
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions public_autoloader/Test-IsDirectory.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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: <https://github.com/SeeminglyScience/dotfiles/blob/7e224fb5fc16998f5956aead620baa4ef9407ebd/PowerShell/Utility.psm1#L231>>
Todo: see: <https://github.com/SeeminglyScience/dotfiles/blob/7e224fb5fc16998f5956aead620baa4ef9407ebd/PowerShell/Utility.psm1#L231>>
foreach ($item in $pathList) {
$extraArgs = ($item = Get-Item $Path -ea 0) -and $item.PSIsContainer | ?? { '' } : { '-r' }
& $code $pathList $extraArgs
Expand All @@ -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
Expand Down

0 comments on commit ebfd039

Please sign in to comment.