function Get-CacheFile { param ( [Parameter(Mandatory = $true, Position = 0)] [Alias('CacheKey')] [Alias('FileName')] $Name ) $defaultCacheFolderName = "CachedFiles" $alkamiPDPath = (Join-Path -Path $env:ProgramData -ChildPath "Alkami") $defaultCacheFolder = (Join-Path $alkamiPDPath $defaultCacheFolderName) $cacheFolder = (Get-EnvironmentVariable -Name "COLEMODULE_$($defaultCacheFolderName)_Path" 6>$null 5>$null 4>$null 3>$null) if ([string]::IsNullOrWhiteSpace($overriddenCacheFolder)) { $cacheFolder = $defaultCacheFolder } $targetPath = (Join-Path $cacheFolder $Name) if (!(Test-Path $cacheFolder)) { New-Item -Path $cacheFolder -ItemType Directory -Force } return $targetPath }