mirror of
				https://github.com/cmderdev/cmder.git
				synced 2025-11-04 19:32:13 +08:00 
			
		
		
		
	add build version str; fix padding
This commit is contained in:
		@@ -73,16 +73,16 @@ function Get-Version-Str($file) {
 | 
				
			|||||||
	return $version
 | 
						return $version
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function Create-RC($version, $path) {
 | 
					function Create-RC($string, $path) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$string   = $version
 | 
						$version  = $string + '.0.0.0.0' # padding for version string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ( !(Test-Path "$path.sample") ) {
 | 
						if ( !(Test-Path "$path.sample") ) {
 | 
				
			||||||
		throw "Invalid path provided for resources file."
 | 
							throw "Invalid path provided for resources file."
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$resource = Get-Content -Path "$path.sample"
 | 
						$resource = Get-Content -Path "$path.sample"
 | 
				
			||||||
	$pattern  = @( "Cmder-Major-Version", "Cmder-Minor-Version", "Cmder-Revision-Version" )
 | 
						$pattern  = @( "Cmder-Major-Version", "Cmder-Minor-Version", "Cmder-Revision-Version", "Cmder-Build-Version" )
 | 
				
			||||||
	$index    = 0
 | 
						$index    = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Replace all non-numeric characters to dots and split to array
 | 
						# Replace all non-numeric characters to dots and split to array
 | 
				
			||||||
@@ -90,13 +90,13 @@ function Create-RC($version, $path) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	foreach ($fragment in $version) {
 | 
						foreach ($fragment in $version) {
 | 
				
			||||||
		if ( !$fragment ) { break }
 | 
							if ( !$fragment ) { break }
 | 
				
			||||||
		elseif ($index -lt $pattern.length) {
 | 
							elseif ($index -le $pattern.length) {
 | 
				
			||||||
			$resource = $resource.Replace( "{" + $pattern[$index++] + "}", '"' + $fragment + '"' )
 | 
								$resource = $resource.Replace( "{" + $pattern[$index++] + "}", $fragment )
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	# Add the version string
 | 
						# Add the version string
 | 
				
			||||||
	$resource = $resource.Replace( "{Cmder-Version-Str}", $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
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user