-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update: 动态替换core中的wcc,wcsc return表达式
使用正则匹配,最大化兼容可能发生的函数名变更
- Loading branch information
Showing
2 changed files
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
# 此脚本用于使修改 core.wxvpkg 内的代码及时生效 | ||
set -e | ||
root_dir=$(cd `dirname $0`/.. && pwd -P) | ||
find_result="$root_dir/package.nw/core.wxvpkg.ext/19c6ae7eff08f795d1f2124f7b0248ad.js" | ||
return_exp_wcc=$(cat $find_result | grep -P 'return [a-z]+\("wcc"\)' -o) # return ?("wcc") | ||
echo "return exp: $return_exp_wcc" | ||
return_exp_wcc_replace="${return_exp_wcc//wcc/wcc.bin}" # return ?("wcc.bin") | ||
echo "replace exp1: $return_exp_wcc_replace" | ||
return_exp_wcc_replace="${return_exp_wcc//return /${return_exp_wcc_replace},}" # return ?("wcc.bin") | ||
echo "replace exp2: $return_exp_wcc_replace" | ||
|
||
return_exp_wcsc=$(cat $find_result | grep -P 'return [a-z]+\("wcsc"\)' -o) # return ?("wcc") | ||
return_exp_wcsc_replace="${return_exp_wcc_replace//wcc/wcsc}" | ||
|
||
sed -i "s#$return_exp_wcc#$return_exp_wcc_replace#g" "$find_result" | ||
sed -i "s#$return_exp_wcsc#$return_exp_wcsc_replace#g" "$find_result" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters