Private/Test-LocalStateDirectory.ps1


function Test-LocalStateDirectory {
    param (
        [string]$LocalStatePath,
        [string]$LogPath,
        [string]$StartBinPath
    )

    if ($null -ne $StartBinPath) {
        if (-Not (Test-Path -Path $LocalStatePath)) {
            New-Item -ItemType Directory -Path $LocalStatePath -Force
            Write-Log -Message "Created LocalState directory." -LogPath $LogPath
        }
        Copy-Item -Path $StartBinPath -Destination $LocalStatePath -Force
        Write-Log -Message "Copied start2.bin to LocalState." -LogPath $LogPath
    } else {
        Write-Log -Message "Start bin path is null, skipping copy." -LogPath $LogPath
    }
}