之前了解了一点解析ips文件的方式,觉得每次都要敲命令行老不爽了,于是乎想要一个一键解析的方式。学习了一会Shell,搞了一个质量很低的代码。。。。但是也满足了我的需求。只需要把相关文件都放到一个文件夹中,./crashReport.sh
一下就可以解析出相应的文件。代码好垃圾😄😄😄,暂时凑合用。
#!/bin/sh
localpath=$(pwd)
#查找文件
function searchFile()
{
cfilelist=$(ls | grep '\.'$1'$')
echo $cfilelist
}
#查找symbolicatecrash
echo "查找symbolicatecrash"
if [ -f "symbolicatecrash" ];then
echo "symbolicatecrash存在"
else
echo "拷贝symbolicatecrash"
path=$(find /Applications/Xcode.app -name symbolicatecrash -type f )
cp $path $localpath
fi
#查找dSYM文件
echo "dSYM:"
searchFile dSYM
dSYM=$(searchFile dSYM);
#查找app文件
echo "app:"
searchFile app
#查找ips文件
echo "ips:"
searchFile ips
ips=$(searchFile ips)
for ipsFile in $ips;
do
# echo $ipsFile
source_suffix="ips"
target_suffix="crash"
newfilename=${ipsFile%.*}
# echo $newfilename
mv $newfilename.$source_suffix $newfilename.$target_suffix
echo $newfilename"修改ips文件Finish"
done
#查找crash文件
echo "crash:"
searchFile crash
crash=$(searchFile crash)
#执行
target="target"
mkdir $target
echo "执行:"
for cfilename in $crash
do
source=${cfilename%.*}
# echo $source
targetfile="target/final->"$source".crash"
# echo "$cfilename"
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
./symbolicatecrash $source.crash "$dSYM" > $targetfile
open $targetfile
done