35 lines
895 B
PowerShell
35 lines
895 B
PowerShell
function Get-ConfigurationDataSourceFileInfo {
|
|
[CmdletBinding()]
|
|
Param(
|
|
[Parameter(Mandatory=$true)]
|
|
[string]
|
|
$Path,
|
|
|
|
[Parameter(Mandatory=$true)]
|
|
[string]
|
|
$BasePath,
|
|
|
|
[Parameter(Mandatory=$false)]
|
|
[switch]
|
|
$UseRelativePath
|
|
)
|
|
|
|
$ResolvedPath = Resolve-ConfigurationDataTemplatePath -Path $Path -BasePath $BasePath
|
|
$Item = Get-Item -LiteralPath $ResolvedPath
|
|
$Hash = Get-FileHash -LiteralPath $ResolvedPath -Algorithm SHA256
|
|
|
|
$DisplayPath = if($UseRelativePath){
|
|
ConvertTo-ConfigurationDataRelativePath -Path $ResolvedPath -BasePath $BasePath
|
|
}else{
|
|
$ResolvedPath
|
|
}
|
|
|
|
[ordered]@{
|
|
Path = $DisplayPath
|
|
Hash = $Hash.Hash
|
|
Algorithm = $Hash.Algorithm
|
|
Size = $Item.Length
|
|
LastWriteTimeUtc = $Item.LastWriteTimeUtc.ToString("o")
|
|
}
|
|
}
|