XCode does not allow a fairly simple directory structure that contains a symbolic link to be copied to an iphone without using a shell script, such as running a dashcode project on the iphone. Xcode's target copy bundle resources or copy file build phases don't do the trick. In my case, I wanted an xcode project that consists of an html page that links to a dashcode project with it's own html file. The directory structure looks like
www/index.html (contains an href="linktodashcodedir/index.html")
www/dashcodedir ( a link to a dashcode project's project directory
dashcodedir (contains an index.html file)
What you end up needing to do is a run script phase that looks like:
rsync -pvtrlL --cvs-exclude "$PROJECT_DIR/../www/" "$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/www"
The problem is that the copy file build phase will not follow a symlink, and if you add the dashcodedir to Xcode to do a second copy file build phase, it won't work with a path of the copy files to $CONTENTS_FOLDER_PATH/www
If you add the www directory as "Convert to Groups", and then take the www group for copy files, the directory structure is flattened.
If you add the www directory as create folder references, then the copy files phase won't follow the symlink.
You can add the www directory as folder references and add the symlinked directory as another folder reference so you have 2 copy files phases. But that forces all the relative links to be up the hierarchy, as in www/index.html contains a link to ../www2/index.html. And it requires every symlink to have it's own root directory, which could quickly scale out of control.
Also, if you want a symbolic link, you have to use unix's ln -s command, not the finders make alias command.
www/index.html (contains an href="linktodashcodedir/index.html")
www/dashcodedir ( a link to a dashcode project's project directory
dashcodedir (contains an index.html file)
What you end up needing to do is a run script phase that looks like:
rsync -pvtrlL --cvs-exclude "$PROJECT_DIR/../www/" "$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/www"
The problem is that the copy file build phase will not follow a symlink, and if you add the dashcodedir to Xcode to do a second copy file build phase, it won't work with a path of the copy files to $CONTENTS_FOLDER_PATH/www
If you add the www directory as "Convert to Groups", and then take the www group for copy files, the directory structure is flattened.
If you add the www directory as create folder references, then the copy files phase won't follow the symlink.
You can add the www directory as folder references and add the symlinked directory as another folder reference so you have 2 copy files phases. But that forces all the relative links to be up the hierarchy, as in www/index.html contains a link to ../www2/index.html. And it requires every symlink to have it's own root directory, which could quickly scale out of control.
Also, if you want a symbolic link, you have to use unix's ln -s command, not the finders make alias command.
Leave a comment