mirror of
https://github.com/electronicarts/CNC_TS_and_RA2_Mission_Editor.git
synced 2025-05-01 01:21:41 -04:00
implemented version helper script .
This commit is contained in:
parent
76febaa726
commit
0fac1ef7b3
1 changed files with 28 additions and 0 deletions
28
scripts/update_product_version.ps1
Normal file
28
scripts/update_product_version.ps1
Normal file
|
@ -0,0 +1,28 @@
|
|||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory=$false, ParameterSetName='Version')]
|
||||
[int]$major,
|
||||
[Parameter(Mandatory=$false, ParameterSetName='Version')]
|
||||
[int]$minor,
|
||||
[Parameter(Mandatory=$true, ParameterSetName='Version')]
|
||||
[int]$revision
|
||||
)
|
||||
|
||||
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
||||
$headerFile = Join-Path $scriptPath "../MissionEditor/Version.h"
|
||||
|
||||
$content = Get-Content -Path $headerFile -Raw
|
||||
|
||||
if ($PSBoundParameters.ContainsKey('major')) {
|
||||
$content = $content -replace 'PRODUCT_VERSION_MAJOR\s+\d+', "PRODUCT_VERSION_MAJOR $major"
|
||||
}
|
||||
|
||||
if ($PSBoundParameters.ContainsKey('minor')) {
|
||||
$content = $content -replace 'PRODUCT_VERSION_MINOR\s+\d+', "PRODUCT_VERSION_MINOR $minor"
|
||||
}
|
||||
|
||||
if ($PSBoundParameters.ContainsKey('revision')) {
|
||||
$content = $content -replace 'PRODUCT_VERSION_REVISION\s+\d+', "PRODUCT_VERSION_REVISION $revision"
|
||||
}
|
||||
|
||||
$content | Set-Content -Path $headerFile
|
Loading…
Add table
Reference in a new issue