Containers/Get-CompilerFromContainer.ps1

function Get-CompilerFromContainer
{
    Param(
        [Parameter(Mandatory=$true)]
        [string]$ContainerName
    )

    $VsixPath = Get-VSCodeExtensionFromContainer -ContainerName $ContainerName

    if (!(Test-path "$VsixPath\Extract")){   
        try {
            Rename-Item $VsixPath "$VsixPath.zip"
            Create-EmptyDirectory "$VsixPath\Extract"   

            Add-Type -AssemblyName System.IO.Compression.FileSystem
            $ZipFile = [IO.Compression.ZipFile]::OpenRead("$VsixPath.zip")
            foreach($Entry in ($ZipFile.Entries | Where-Object FullName -Match 'extension/bin/')){
                $File = Join-Path "$VsixPath\Extract" $Entry.FullName
                $Directory = Split-Path -Parent $File
                if(!(Test-Path $Directory)) {
                    New-Item -Path $Directory -Type Directory | Out-Null
                }
                [IO.Compression.ZipFileExtensions]::ExtractToFile($entry, $file, $true)
            }
            $ZipFile.Dispose()
        }
        catch {
            throw 'failed to extract compiler'
        }
    }

    if (Test-Path "$VsixPath\Extract\extension\bin\alc.exe"){
        return "$VsixPath\Extract\extension\bin\alc.exe"
    } elseif (Test-Path "$VsixPath\Extract\extension\bin\win32\alc.exe"){
        return "$VsixPath\Extract\extension\bin\win32\alc.exe"
    } else {
        Write-Error 'could not locate compiler file alc.exe'
    }
}

Export-ModuleMember -Function Get-CompilerFromContainer