在 Xcode 中复制捆绑资源时解析符号链接 [英] Resolve symbolic links when copying bundle resources in Xcode

查看:23
本文介绍了在 Xcode 中复制捆绑资源时解析符号链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Xcode 中有一个项目和该项目的一些资源.资源包含几个符号链接.当 Xcode 构建项目时,它会复制资源,但不会解析符号链接.有没有办法告诉 Xcode 解析链接?(即复制链接目标而不是链接本身.)

I have a project in Xcode and some resources for the project. The resources contain several symbolic links. When Xcode builds the project, it copies the resources, but does not resolve the symbolic links. Is there a way to tell Xcode to resolve the links? (Ie. have the link targets copied instead of the links themselves.)

更新:谢谢,mouviciel,差不多就是这样.起初我尝试使用复制文件阶段来完成它,但是这个阶段调用的 pbxcp 程序也没有解析链接,即使有一些名为 -resolve-src-符号链接.我最终添加了一个运行脚本阶段,调用如下:

Update: Thanks, mouviciel, that was almost it. At first I tried to do it using the Copy Files phase, but the pbxcp program called by this phase did not resolve the links either, even though there is some switch called -resolve-src-symlinks. I ended up adding a Run Script phase calling something like this:

rsync -pvtrlL --cvs-exclude \
    $PROJECT_DIR/../Resources* \
    $BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH

幸运的副作用是我不再需要更新 Xcode 中的 Resources 组,Resources 目录中所做的任何更改都立即可见.

Fortunate side effect is that I no longer need to keep the Resources group in Xcode updated, whatever changes done in the Resources directory are immediately visible.

推荐答案

一个解决方案可能是插入一个运行脚本构建阶段,它完全按照你想要的方式执行复制,即通过取消引用符号链接(这是默认行为cp).

A solution could be to insert a Run Script Build Phase which performs the copy exactly the way you want, i.e., by dereferencing symbolic links (this is the default behaviour of cp).

这篇关于在 Xcode 中复制捆绑资源时解析符号链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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