From 018bf45df462f4ecc2d68309d5e3425acb3abd78 Mon Sep 17 00:00:00 2001 From: David Refoua Date: Wed, 28 Mar 2018 21:13:55 +0430 Subject: [PATCH] add version string handler --- scripts/utils.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/utils.ps1 b/scripts/utils.ps1 index 7474a58..5cc6035 100644 --- a/scripts/utils.ps1 +++ b/scripts/utils.ps1 @@ -75,9 +75,10 @@ function Get-Version-Str($file) { function Create-RC($version, $path) { + $string = $version + if ( !(Test-Path "$path.sample") ) { - Write-Error "Invalid path provided for resources file." - return + throw "Invalid path provided for resources file." } $resource = Get-Content -Path "$path.sample" @@ -93,6 +94,9 @@ function Create-RC($version, $path) { $resource = $resource.Replace( "{" + $pattern[$index++] + "}", $fragment ) } } + + # Add the version string + $resource = $resource.Replace( "{Cmder-Version-Str}", $string ) # Write the results Set-Content -Path $path -Value $resource