Modules/businessdev.ALbuild.Core/Private/Get-ALbuildUserModuleRoot.ps1

function Get-ALbuildUserModuleRoot {
    <#
    .SYNOPSIS
        The CurrentUser module root for the CURRENT PowerShell edition.
    .DESCRIPTION
        Windows PowerShell 5.1 (Desktop) and PowerShell 7 (Core) use DIFFERENT roots
        (…\Documents\WindowsPowerShell\Modules vs …\Documents\PowerShell\Modules). Installing under one
        leaves the other with a stale copy - a documented aggravator of the outage. MyDocuments (not a
        hard-coded '~\Documents') is used so a redirected/OneDrive Documents folder resolves correctly.
    .OUTPUTS
        System.String - the '…\Modules' path.
    #>

    [CmdletBinding()]
    [OutputType([string])]
    param()
    $docs = [Environment]::GetFolderPath('MyDocuments')
    if ([string]::IsNullOrWhiteSpace($docs)) { $docs = Join-Path $HOME 'Documents' }
    $editionFolder = if ($PSVersionTable.PSEdition -eq 'Core') { 'PowerShell' } else { 'WindowsPowerShell' }
    Join-Path (Join-Path $docs $editionFolder) 'Modules'
}