mirror of
https://github.com/Leo501/CocosCreatorTutorial.git
synced 2026-05-07 14:17:49 +08:00
21 lines
696 B
JavaScript
21 lines
696 B
JavaScript
const fileUtil = require('./FileUtil');
|
|
let version, androidVersionXml;
|
|
|
|
function initParams(configPath) {
|
|
let data = JSON.parse(fileUtil.read(configPath));
|
|
version = data.version;
|
|
androidVersionXml = data.root + 'frameworks/runtime-src/proj.android/AndroidManifest.xml';
|
|
}
|
|
|
|
function repreatAndroidVersion(path) {
|
|
let old = fileUtil.read(path);
|
|
old = old.replace(/android:versionName="([1-9]\d|[1-9])(\.([1-9]\d|\d)){2}"/, `android:versionName="${version}"`);
|
|
let result = Buffer.from(old);
|
|
return fileUtil.write(path, result)
|
|
}
|
|
|
|
function main(params) {
|
|
initParams('./GameConfig.json');
|
|
//修改android 版本号
|
|
repreatAndroidVersion(androidVersionXml);
|
|
} |