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.

zoul
  • 102,279
  • 44
  • 260
  • 354
  • Did you, over time, come to a better solution? I'd appreciate if you shared it :) – matm Apr 26 '12 at 21:21
  • Well, after testing your solution I find it elegant and concise, thanks for sharing! :) – matm Apr 26 '12 at 21:33
  • This works perfectly!!! Thank you man! You saved me hours of frustration with Phonegap shared files. – Jack Jun 01 '12 at 15:26

1 Answers1

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

mouviciel
  • 66,855
  • 13
  • 106
  • 140