做一个创建cocos2d-x新项目的shell脚本
1. 进入console目录
cd /Users/apple/Documents/MyArchitecture/Cocos2d-x/Framework/cocos2d-x-3.4/tools/cocos2d-console/bin
2. 编写shell脚本存放在自己的程序目录
newproject.sh
#!/bin/bash echo Please Input Project Name: read PROJECT_NAME echo Please Input Package Name: read PACKAGE_NAME #enter directory cd /Users/apple/Documents/MyArchitecture/Cocos2d-x/Train #create Project PROJECT_DIR="/Users/apple/Documents/MyArchitecture/Cocos2d-x/Train" echo $PROJECT_DIR cocos new $PROJECT_NAME -p $PACKAGE_NAME -l cpp -d $PROJECT_DIR
3. 执行shell脚本
chmode +x
/Users/apple/Documents/MyArchitecture/Cocos2d-x/newproject.sh
4. 如果发生错误怎么修复
cocos: command not found
source ~./bash_profile
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。