Resolve symbolic links when copying bundle resources in Xcode

杀马特。学长 韩版系。学妹 提交于 2019-12-03 05:01:18

问题


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.)

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

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.


回答1:


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).



来源:https://stackoverflow.com/questions/540661/resolve-symbolic-links-when-copying-bundle-resources-in-xcode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!