2023-03-08 06:20:13 +08:00
|
|
|
#!/usr/bin/env bash
|
2021-12-03 15:16:27 +08:00
|
|
|
|
2021-12-06 07:55:10 +08:00
|
|
|
#
|
|
|
|
#
|
|
|
|
# This is the Bash equivalent of ../windows/set-smapi-version.ps1.
|
|
|
|
# When making changes, both scripts should be updated.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
|
2021-12-03 15:16:27 +08:00
|
|
|
# get version number
|
|
|
|
version="$1"
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
echo "SMAPI release version (like '4.0.0'):"
|
|
|
|
read version
|
|
|
|
fi
|
|
|
|
|
|
|
|
# move to SMAPI root
|
2021-12-06 07:55:10 +08:00
|
|
|
cd "`dirname "$0"`/../.."
|
2021-12-03 15:16:27 +08:00
|
|
|
|
|
|
|
# apply changes
|
|
|
|
sed "s/<Version>.+<\/Version>/<Version>$version<\/Version>/" "build/common.targets" --in-place --regexp-extended
|
|
|
|
sed "s/RawApiVersion = \".+?\";/RawApiVersion = \"$version\";/" "src/SMAPI/Constants.cs" --in-place --regexp-extended
|
|
|
|
for modName in "ConsoleCommands" "ErrorHandler" "SaveBackup"; do
|
|
|
|
sed "s/\"(Version|MinimumApiVersion)\": \".+?\"/\"\1\": \"$version\"/g" "src/SMAPI.Mods.$modName/manifest.json" --in-place --regexp-extended
|
|
|
|
done
|