Files
Resolve-DSCConfigurationData/Private/Resolve-ConfigurationDataProviderSettingsPath.ps1

29 lines
793 B
PowerShell

function Resolve-ConfigurationDataProviderSettingsPath {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
[string]
$Provider,
[Parameter(Mandatory=$false)]
[AllowEmptyString()]
[string]
$SettingsPath
)
$FileName = "ProviderSettings.$Provider.psd1"
if([string]::IsNullOrWhiteSpace($SettingsPath)){
return (Join-Path -Path (Get-Location).Path -ChildPath $FileName)
}
if((Test-Path -Path $SettingsPath -PathType Container) -or
$SettingsPath.EndsWith("\") -or
$SettingsPath.EndsWith("/") -or
[string]::IsNullOrWhiteSpace([System.IO.Path]::GetExtension($SettingsPath))){
return (Join-Path -Path $SettingsPath -ChildPath $FileName)
}
return $SettingsPath
}