Add functions for configuration data handling and extend template merging capabilities
This commit is contained in:
24
Private/Resolve-ConfigurationDataTemplatePath.ps1
Normal file
24
Private/Resolve-ConfigurationDataTemplatePath.ps1
Normal file
@@ -0,0 +1,24 @@
|
||||
function Resolve-ConfigurationDataTemplatePath {
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]
|
||||
$Path,
|
||||
|
||||
[Parameter(Mandatory=$false)]
|
||||
[string]
|
||||
$BasePath = (Get-Location).Path
|
||||
)
|
||||
|
||||
$CandidatePath = $Path
|
||||
if(-not [System.IO.Path]::IsPathRooted($CandidatePath)){
|
||||
$CandidatePath = Join-Path -Path $BasePath -ChildPath $CandidatePath
|
||||
}
|
||||
|
||||
$ResolvedPath = Resolve-Path -Path $CandidatePath -ErrorAction SilentlyContinue
|
||||
if($null -eq $ResolvedPath){
|
||||
throw "Configuration data template [$Path] was not found. Base path [$BasePath]."
|
||||
}
|
||||
|
||||
return $ResolvedPath.ProviderPath
|
||||
}
|
||||
Reference in New Issue
Block a user