Xcode:如何将当前工作目录设置为可执行文件的相对路径? [英] Xcode: How to set current working directory to a relative path for an executable?

查看:29
本文介绍了Xcode:如何将当前工作目录设置为可执行文件的相对路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Xcode 中有一个命令行可执行文件.

I have a command-line executable in Xcode.

我使用的是 Xcode 5.1.在选项"下项目的方案编辑器"中有一个工作目录"选项.如何指定相对于 .xcodeproj 文件的路径?我试过一次.

I am using Xcode 5.1. In the "Scheme Editor" for the project under "Options" there is an option for "Working Directory". How can I specify a path relative to the .xcodeproj file? I have tried a single period.

我需要这个,因为代码需要假设存在相对于项目目录的文件.

I need this because the code needs to assume the existence of files relative to the project directory.

推荐答案

您可以使用 Xcode 构建设置变量PROJECT_DIR,例如将您的工作目录设置为 $PROJECT_DIR/.. 将使其等于您的项目目录的父目录.

You can use Xcode build setting variables such as PROJECT_DIR, e.g. setting your working directory to $PROJECT_DIR/.. will make it equal to the parent directory of your project directory.

这篇关于Xcode:如何将当前工作目录设置为可执行文件的相对路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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