添加新文件时 Xcode 项目中相对路径的错误行为

发布于 2024-09-25 18:21:33 字数 609 浏览 7 评论 0原文

首先,我远非 Xcode 专家,而且几乎是一个新手。最简单的事情已经困扰我们的团队相当长一段时间了:

每当我为项目添加一个新文件并选择“相对于项目”或“相对于封闭组”时,我总是会得到一个半相对路径。我得到了以下内容:

../../../../../Trunk/ProjectName/Sources/MyFile.h

应该在哪里只能是:

../../../Sources/MyFile.h

因为 Xcode 项目位于目录:

/Dev/App /Trunk/ProjectName/Project/MAC/XCode/

这让我们很头疼,因为并不是每个开发人员的“Trunk”和“Project”目录标记相同,然后 XCode 就会显示这些项目红色,因为它可以找到它们并且不允许项目编译。

即使我直接更改文件信息中的“路径类型”,也无法获得预期的相对路径。唯一的解决方案是手动编辑 .xcodeproj。

项目根设置为:“项目文件目录”

我还缺少什么吗?这是使用 Xcode 3.2。

First of all, I am far from an Xcode guru and pretty much a newbie with it. The simplest thing have been bugging our team for quite sometime:

Whenever I had a new file to the project and select "Relative to Project" or "Relative to Enclosing Group" I will always get a semi-relative path. I get something in the line of:

../../../../../Trunk/ProjectName/Sources/MyFile.h

where as it should only be:

../../../Sources/MyFile.h

since the Xcode project is in the directory:

/Dev/App/Trunk/ProjectName/Project/MAC/XCode/

This is causing us alot of headaches since not every developer as their "Trunk" and "Project" directory labeled the same and XCode will then show these items in red since it can find them and won't allow the project to compile.

There is no way to obtain the expected relative path, even when I change the "Path Type" in the file info directly. The only solution is to manually edit the .xcodeproj.

The project roots is set to : "Project File Directory"

Is there anything else I am missing? This is using Xcode 3.2.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深白境迁sunset 2024-10-02 18:21:33

是的,我最近在 Xcode 3.2.3 中看到了这个问题。我认为这一定是最近引入的错误,因为这在早期版本中总是按预期工作。希望 4.0 最终发布时它会得到修复,但您始终可以在 http://bugreporter.apple.com 提交错误报告 同时。目前,我已通过编辑 project.pbxproj 手动修复此问题,以删除相对路径的冗余部分。

Yes, I've been seeing this problem recently in Xcode 3.2.3. I think it must be a recently introduced bug because this always used to work as expected in earlier versions. Hopefully it will be fixed when 4.0 eventually gets released, but you could always file a bug report at http://bugreporter.apple.com in the mean time. For now I've been fixing this manually by editing project.pbxproj to remove the redundant parts of the relative path.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文