Resolve symbolic links when copying bundle resources in Xcode
Asked Answered
T

1

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.

Trout answered 12/2, 2009 at 9:51 Comment(3)
Did you, over time, come to a better solution? I'd appreciate if you shared it :)Chaplin
Well, after testing your solution I find it elegant and concise, thanks for sharing! :)Chaplin
This works perfectly!!! Thank you man! You saved me hours of frustration with Phonegap shared files.Swale
N
8

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

Nostrum answered 12/2, 2009 at 10:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.