【发布时间】:2015-02-19 18:54:17
【问题描述】:
我创建了一个基于官方 Cocos2dx 示例的项目。在脚本中,它尝试使用以下内容读取本地属性:
_LOCALPROPERTIES_FILE=$(dirname "$0")"/local.properties"
if [ -f "$_LOCALPROPERTIES_FILE" ]
then
[ -r "$_LOCALPROPERTIES_FILE" ] || die "Fatal Error: $_LOCALPROPERTIES_FILE exists but is unreadable"
# strip out entries with a "." because Bash cannot process variables with a "."
_PROPERTIES=`sed '/\./d' "$_LOCALPROPERTIES_FILE"`
for line in "$_PROPERTIES"; do
declare "$line";
echo "$line";
done
fi
然后它会尝试获取 NDK_ROOT:
if [ -z "${NDK_ROOT+aaa}" ];then
echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in local.properties"
exit 1
fi
如果我在 local.properties 中定义 NDK 根,如下所示:
NDK_ROOT=/Users/myuser/Documents/android-ndk-r9d
它无法识别该属性,尽管我确实在控制台中看到了这一行。为什么这个脚本无法将 local.properties 读入变量?这是脚本中的错误还是我如何定义我的属性?我怀疑脚本不正确。我知道我可以定义环境变量,但我真的很想将这些变量保存在我的 local.properties 中,而不是弄乱人们的 bash 配置文件。
【问题讨论】:
标签: java android bash cocos2d-x