Merge pull request #10774 from obrakmann/fix-make-version

Fix 'make version' to adjust the user's custom map path
This commit is contained in:
abcdefg30
2016-02-20 17:28:27 +01:00
2 changed files with 12 additions and 2 deletions

View File

@@ -363,7 +363,7 @@ version: mods/ra/mod.yaml mods/cnc/mod.yaml mods/d2k/mod.yaml mods/ts/mod.yaml m
@for i in $? ; do \
awk '{sub("Version:.*$$","Version: $(VERSION)"); print $0}' $${i} > $${i}.tmp && \
awk '{sub("\tmodchooser:.*$$","\tmodchooser: $(VERSION)"); print $0}' $${i}.tmp > $${i}.tmp2 && \
awk '{sub("/[^/]*@User$$", "/$(VERSION)@User"); print $0}' $${i}.tmp2 > $${i} && \
awk '{sub("/[^/]*: User$$", "/$(VERSION): User"); print $0}' $${i}.tmp2 > $${i} && \
rm $${i}.tmp $${i}.tmp2; \
done

View File

@@ -113,7 +113,17 @@ elseif ($command -eq "version")
{
$replacement = (gc $mod) -Replace "Version:.*", ("Version: {0}" -f $version)
sc $mod $replacement
$replacement = (gc $mod) -Replace "modchooser:.*", ("modchooser: {0}" -f $version)
# The tab is a workaround for not replacing inside of "Packages:"
$replacement = (gc $mod) -Replace " modchooser:.*", (" modchooser: {0}" -f $version)
sc $mod $replacement
$prefix = $(gc $mod) | Where { $_.ToString().EndsWith(": User") }
if ($prefix -and $prefix.LastIndexOf("/") -ne -1)
{
$prefix = $prefix.Substring(0, $prefix.LastIndexOf("/"))
}
$replacement = (gc $mod) -Replace ".*: User", ("{0}/{1}: User" -f $prefix, $version)
sc $mod $replacement
}
echo ("Version strings set to '{0}'." -f $version)