27 lines
1022 B
PowerShell
27 lines
1022 B
PowerShell
|
function Get-LatestVersionManifest {
|
||
|
#$manifestFolder = (Join-Path -Path (Split-Path $PSScriptRoot -Parent) -ChildPath "Manifests")
|
||
|
#if (!(Test-Path -Path $manifestFolder)) {
|
||
|
# $manifestFolder = (Join-Path -Path $PSScriptRoot -ChildPath "Manifests")
|
||
|
#}
|
||
|
|
||
|
$manifestFolder = Get-ManifestPath
|
||
|
|
||
|
if (!(Test-Path -Path $manifestFolder)) {
|
||
|
throw "$logLead : Can't find the manifest folder"
|
||
|
}
|
||
|
|
||
|
$files = Get-ChildItem -Path (Join-Path $manifestFolder "*.json")
|
||
|
$fileNames = @()
|
||
|
foreach ($file in $files) {
|
||
|
$fileName = [System.IO.Path]::GetFileNameWithoutExtension($file.FullName)
|
||
|
$fileNameSplits = $fileName -split '\.'
|
||
|
$versionMajor = $fileNameSplits[0]
|
||
|
$versionMinor = $fileNameSplits[1]
|
||
|
$version = "$versionMajor.$versionMinor"
|
||
|
if ($fileNames -notcontains $version) {
|
||
|
Write-Verbose "$logLead : Found version $version"
|
||
|
$fileNames += $version
|
||
|
}
|
||
|
}
|
||
|
return $fileNames | Sort-Object | Select-Object -Last 1
|
||
|
}
|