public/Get-RecipeImageFolder.ps1

function Get-RecipeImageFolder {
    [CmdletBinding()]
    param()

    # Try PSU-native paths first
    $base = $null

    if ($env:PSUContentPath) {
        # Some PSU environments expose this
        $base = $env:PSUContentPath
    }
    elseif ($env:PowerShellUniversalDataPath) {
        $base = $env:PowerShellUniversalDataPath
    }
    elseif ($env:HOME) {
        # Works well on Linux: /home/psuniversal/.PowerShellUniversal
        $base = Join-Path $env:HOME ".PowerShellUniversal"
    }
    else {
        # Cross-platform: Windows -> C:\ProgramData, Linux -> /usr/share (or similar)
        $base = [Environment]::GetFolderPath([Environment+SpecialFolder]::CommonApplicationData)
    }

    if (-not $base) {
        # Last-ditch fallback so we never return null
        $base = $PSScriptRoot
    }

    $folder = Join-Path $base "CookbookImages"

    if (-not (Test-Path $folder)) {
        New-Item -Path $folder -ItemType Directory -Force | Out-Null
    }

    $folder
}