Skip to content

Commit d58bb53

Browse files
committed
Fix output to always be string and allow relative paths
1 parent 0a04ad5 commit d58bb53

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

Modules/DSCParser/Modules/DSCParser.psm1

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ function ConvertTo-DSCObject
127127
throw "DSCParser.CSharp assembly is not loaded. Module initialization failed."
128128
}
129129

130+
# Fully qualify path
131+
if ($PSCmdlet.ParameterSetName -eq 'Path')
132+
{
133+
$Path = (Resolve-Path -Path $Path).Path
134+
}
135+
130136
try
131137
{
132138
if ($null -eq $Script:DscResourceCache -and -not $PSBoundParameters.ContainsKey('DscResourceInfo'))
@@ -208,6 +214,10 @@ function ConvertFrom-DSCObject
208214
$ChildLevel = 0
209215
)
210216

217+
begin
218+
{
219+
$result = [System.Collections.Generic.List[System.String]]::new($DSCResources.Count)
220+
}
211221
process
212222
{
213223
if (-not $Script:AssemblyLoaded)
@@ -217,13 +227,16 @@ function ConvertFrom-DSCObject
217227

218228
try
219229
{
220-
$result = [DSCParser.CSharp.DscParser]::ConvertFromDscObject($DSCResources, $ChildLevel)
221-
return $result
230+
$result.Add([DSCParser.CSharp.DscParser]::ConvertFromDscObject($DSCResources, $ChildLevel))
222231
}
223232
catch
224233
{
225234
Write-Error "Error converting DSC objects: $_"
226235
throw
227236
}
228237
}
238+
end
239+
{
240+
return [System.String]::Join("", $result)
241+
}
229242
}

0 commit comments

Comments
 (0)