Skip to content

Commit 0a83644

Browse files
committedNov 17, 2019
2.1.2
1 parent 731e910 commit 0a83644

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed
 

‎#ModRelease/#ModRelease.ps1

+17-8
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,16 @@ function New-UniversalModPackage {
166166
$ModVersion = Get-IEModVersion -Path $ModMainFile.FullName
167167
if ($null -eq $ModVersion -or $ModVersion -eq '') { $ModVersion = '0.0.0' }
168168

169-
$PackageBaseName = "$ModID-$ModVersion"
169+
$iniData = try { Get-Content $ModTopDirectory\$ModID\$ModID.ini -EA 0 } catch { }
170+
if ($iniData) {
171+
$ModDisplayName = (($iniData | ? { $_ -notlike "*#*" -and $_ -like "Name*=*" }) -split '=')[1].TrimStart(' ').TrimEnd(' ')
172+
173+
# Github release asset name limitation
174+
$PackageName = "$($ModDisplayName -replace "\s",'-')-$($ModVersion -replace "\s",'-')"
175+
176+
} else {
177+
$PackageName = "$($ModID -replace "\s",'-')-$($ModVersion -replace "\s",'-')"
178+
}
170179

171180
# cleanup old files
172181
Remove-Item -Path "$ModTopDirectory\*.iemod" -Force -EA 0 | Out-Null
@@ -194,10 +203,10 @@ function New-UniversalModPackage {
194203
#iemod package
195204
Copy-Item -Path $ModTopDirectory\$ModID\* -Destination $tempDir\$outIEMod\$ModID -Recurse -Exclude $regexAny | Out-Null
196205

197-
Write-Host "Creating $PackageBaseName.iemod" -ForegroundColor Green
206+
Write-Host "Creating $PackageName.iemod" -ForegroundColor Green
198207

199-
Compress-Archive -Path $tempDir\$outIEMod\* -DestinationPath "$ModTopDirectory\$PackageBaseName.zip" -Force -CompressionLevel Optimal | Out-Null
200-
Rename-Item -Path "$ModTopDirectory\$PackageBaseName.zip" -NewName "$PackageBaseName.iemod" -Force | Out-Null
208+
Compress-Archive -Path $tempDir\$outIEMod\* -DestinationPath "$ModTopDirectory\$PackageName.zip" -Force -CompressionLevel Optimal | Out-Null
209+
Rename-Item -Path "$ModTopDirectory\$PackageName.zip" -NewName "$PackageName.iemod" -Force | Out-Null
201210

202211
# zip package
203212
Copy-Item -Path $ModTopDirectory\$ModID\* -Destination $tempDir\$outZip\$ModID -Recurse -Exclude $regexAny | Out-Null
@@ -220,9 +229,9 @@ function New-UniversalModPackage {
220229
# Create .command script
221230
'cd "${0%/*}"' + "`n" + 'ScriptName="${0##*/}"' + "`n" + './${ScriptName%.*}' | Out-File -FilePath "$tempDir\$outZip\$($weiduExeBaseName.tolower()).command" | Out-Null
222231

223-
Write-Host "Creating $PackageBaseName.zip" -ForegroundColor Green
232+
Write-Host "Creating $PackageName.zip" -ForegroundColor Green
224233

225-
Compress-Archive -Path $tempDir\$outZip\* -DestinationPath "$ModTopDirectory\$PackageBaseName.zip" -Force -CompressionLevel Optimal | Out-Null
234+
Compress-Archive -Path $tempDir\$outZip\* -DestinationPath "$ModTopDirectory\$PackageName.zip" -Force -CompressionLevel Optimal | Out-Null
226235
}
227236
end {
228237
if ($excludedAny) {
@@ -277,7 +286,7 @@ $ModID = $ModMainFile.BaseName -replace 'setup-'
277286
$ModVersion = Get-IEModVersion -Path $ModMainFile.FullName
278287
if ($null -eq $ModVersion -or $ModVersion -eq '') { $ModVersion = '0.0.0' }
279288

280-
$PackageBaseName = "$ModID-$ModVersion"
289+
$PackageName = "$ModID-$ModVersion"
281290

282291
$newTagRelease = $ModVersion -replace "\s+", '_'
283292

@@ -361,7 +370,7 @@ $releaseID = $json.id
361370
New-UniversalModPackage -ModTopDirectory $ModTopDirectory
362371

363372
# Universal Mod Package, Zip Package, Windows Self-Extracting WinRar Package
364-
$fileName = Get-Item -Path "$PackageBaseName.iemod", "$PackageBaseName.zip" -EA 0
373+
$fileName = Get-Item -Path "$PackageName.iemod", "$PackageName.zip" -EA 0
365374

366375
$fileName | % {
367376
$fullName = Get-ChildItem $_ -EA 0 | Select-Object -ExpandProperty FullName

0 commit comments

Comments
 (0)
Please sign in to comment.