Xcode 脚本上的相对路径 [英] Relative paths on Xcode scripts

查看:49
本文介绍了Xcode 脚本上的相对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Xcode 运行脚本,但有几个问题:

I'm experimenting running scripts with Xcode and have got a couple of questions:

1) Xcode 说要将脚本拖放到运行脚本部分,但这会创建一个绝对路径:/Users/Me/Desktop/Project/etc.如果其他人或 CI 机器检查代码,这显然没有用.如何指定相对路径?

1) Xcode says to drag n drop the script into the run script section but that creates an absolute path: /Users/Me/Desktop/Project/etc. which is obviously no use if somebody else or a CI machine checks out the code. How to specify a relative path?

2) 在构建过程中执行脚本时出现权限被拒绝错误.

2) There's a permission denied error during the build when the script gets executed.

(我在这里使用脚本来试验 https://gist.github.com/sekati/3172554)

(I'm using scripts off here to experiment with https://gist.github.com/sekati/3172554)

推荐答案

1) 在我的一个 Xcode 项目中,我有以下生成源代码文档的脚本.正如您所看到的,脚本的每一行都使用了一个相对路径.我什至不需要使用 ${SRCROOT}.

1) In an Xcode project of mine, I have the following script that generates the source code documentation. As you can see each line of the script uses a relative path. I don't even need to use ${SRCROOT}.

# change directory because Doxyfile is configured with a relative input path ".."
cd doxygen

# clean the directory
rm -rf html

# generate docs
/opt/local/bin/doxygen Doxyfile

# open the html documentation
open html/index.html

2) permission denied"错误的原因可能是你没有在脚本上设置可执行位.在控制台上,键入此命令以设置可执行位,然后再次尝试运行脚本.

2) The reason for the "permission denied" error may be that you have not set the executable bit on the script. On the console, type this command to set the executable bit, then try again to run the script.

chmod +x /path/to/xcode-build-bump.sh

这篇关于Xcode 脚本上的相对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆