#!/bin/bash
my_name_s="五笔98版"
my_name_t="五筆98版"
my_folder="WB98"
my_package="trime_0"
echo "『包名』和『存储目录』同时修改过后,才能与原版本存。"
echo "修改后的『简体名称』是:${my_name_s}"
echo "修改后的『繁体名称』是:${my_name_t}"
echo "修改后的『存储目录』是:${my_folder}"
echo "修改后的『包名』是:${my_package}"
echo "修改 Makefile 配置文件的『默认路径』。"
sed -i "s/\/rime\//\/${my_folder}\//g" ./Makefile
echo "修改 build.gradle 配置文件的『包名称』。"
sed -i "s/com.osfans.trime/com.osfans.${my_package}/g" ./app/build.gradle
echo "修改『包目录』。"
mv ./app/src/main/java/com/osfans/trime ./app/src/main/java/com/osfans/${my_package}
mv ./app/src/main/assets/rime ./app/src/main/assets/${my_folder}
echo "修改 AndroidManifest 中的『包名称』。"
sed -i "s/com.osfans.trime/com.osfans.${my_package}/g" ./app/src/main/AndroidManifest.xml
echo "修改 JAVA 中的『包名称』。"
sed -i "s/com.osfans.trime/com.osfans.${my_package}/g" ./app/src/main/java/com/osfans/${my_package}/enums/*.java
sed -i "s/com.osfans.trime/com.osfans.${my_package}/g" ./app/src/main/java/com/osfans/${my_package}/*.java
sed -i "s/\"rime/\"${my_folder}/g" ./app/src/main/java/com/osfans/${my_package}/ResetDialog.java
sed -i "s/\"rime\"/\"${my_folder}\"/g" ./app/src/main/java/com/osfans/${my_package}/Config.java
echo "修改 CMakeLists.txt 中的『类名称』。"
sed -i "s/\/trime\//\/${my_package}\//g" ./app/src/main/jni/CMakeLists.txt
echo "修改『软件名称』。"
sed -i "s/同文输入法/${my_name_s}/g" ./app/src/main/res/values-zh-rCN/strings.xml
sed -i "s/同文輸入法/${my_name_t}/g" ./app/src/main/res/values-zh-rTW/strings.xml
echo "修改 donottranslate.xml 文件的『默认路径』。"
sed -i "s/sdcard\/rime/sdcard\/${my_folder}/g" ./app/src/main/res/values/donottranslate.xml
echo "修改 xml 文件夹的『包名称』。"
sed -i "s/com.osfans.trime/com.osfans.${my_package}/g" ./app/src/main/res/xml/method.xml
sed -i "s/<com.osfans.trime./<com.osfans.${my_package}./g" ./app/src/main/res/xml/prefs.xml
echo "修改 layout 文件夹的『包名称』。"
sed -i "s/com.osfans.trime/com.osfans.${my_package}/g" ./app/src/main/res/layout/*.xml
unset my_name_s
unset my_name_t
unset my_folder
unset my_package
echo "修改完成,可以放入配置文件打包了!"
网友评论