Skip to content

Commit

Permalink
Merge pull request #21 from victorvogelpoel/master
Browse files Browse the repository at this point in the history
Adding an extra test for empty strings in $Source to prevent Resolve-Path errors
  • Loading branch information
KevinMarquette authored Feb 21, 2017
2 parents 52bfa5d + dcf437d commit c93ea45
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion PSGraph/Public/Export-PSGraph.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,15 @@ function Export-PSGraph
if( $null -ne $Source -and $Source.Count -gt 0)
{
# if $Source is a list of files, process each one
$fileList = Resolve-Path -Path $Source -ea 0
$fileList = $null

# Only resolve paths, if there are NO empty string entries in the $Source
# Resolve-path spits out an error with empty string paths, even with SilentlyContinue
if (@($Source | where { [String]::IsNullOrEmpty($_) } ).Count -eq 0)
{
$fileList = Resolve-Path -Path $Source -ErrorAction SilentlyContinue
}

if( $null -ne $fileList -and $Source.Count -gt 0)
{
foreach( $file in $fileList )
Expand Down

0 comments on commit c93ea45

Please sign in to comment.