wechat-web-devtools-linux/bin/wechat-devtools
2022-02-18 12:52:32 +08:00

42 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
root_dir=$(cd `dirname $0`/.. && pwd -P)
export WECHAT_DEVTOOLS_DIR="$root_dir/nwjs"
export APPDATA="$( echo ~ )/.config/wechat_devtools"
export PATH="$root_dir/wine:$root_dir/node/bin:$root_dir/nwjs:$PATH"
export USERPROFILE=$( echo ~ )
current=`date "+%Y-%m-%d %H:%M:%S"`
timeStamp=`date -d "$current" +%s`
# 获取首次运行时间
if [[ -f "$APPDATA/.run_time" ]];then
run_time=`cat "$APPDATA/.run_time"`
else
run_time=0
fi
# 获取构建时间
if [[ -f "$root_dir/package.nw/.build_time" ]];then
build_time=`cat "$root_dir/package.nw/.build_time"`
else
build_time=timeStamp
fi
if [[ ! $build_time < $run_time ]];then
echo "清理缓存"
echo $timeStamp > "$APPDATA/.run_time"
rm -rf "$APPDATA/WeappCache"
rm -rf "$APPDATA/WeappVendor"
fi
EXTENSION1="--load-extension=$root_dir/nwjs/package.nw/js/ideplugin"
EXTENSION2=--load-extension=~/.config/wechat_devtools/WeappPlugin
INSPECTOR1="--custom-devtools-frontend=file://$root_dir/package.nw/js/ideplugin/inspector" # 要加file://指明为本地文件路径
INSPECTOR2="--custom-devtools-frontend=file://$( echo ~ )/.config/wechat_devtools/WeappPlugin/inspector/"
USERDATADIR="$( echo ~ )/.config/wechat_devtools"
# "$@"参数
LANG=zh_CN.UTF-8
exec "$root_dir/nwjs/nw" $root_dir/package.nw $EXTENSION2 $INSPECTOR1 "$@"