add version string handler

This commit is contained in:
David Refoua 2018-03-28 21:13:55 +04:30 committed by GitHub
parent f8359fc3f7
commit 018bf45df4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,9 +75,10 @@ function Get-Version-Str($file) {
function Create-RC($version, $path) { function Create-RC($version, $path) {
$string = $version
if ( !(Test-Path "$path.sample") ) { if ( !(Test-Path "$path.sample") ) {
Write-Error "Invalid path provided for resources file." throw "Invalid path provided for resources file."
return
} }
$resource = Get-Content -Path "$path.sample" $resource = Get-Content -Path "$path.sample"
@ -94,6 +95,9 @@ function Create-RC($version, $path) {
} }
} }
# Add the version string
$resource = $resource.Replace( "{Cmder-Version-Str}", $string )
# Write the results # Write the results
Set-Content -Path $path -Value $resource Set-Content -Path $path -Value $resource