iPhone tip: Installing directory containing symlink requires run script phase in XCode

| | Comments (0) | TrackBacks (0)
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.    

0 TrackBacks

Listed below are links to blogs that reference this entry: iPhone tip: Installing directory containing symlink requires run script phase in XCode.

TrackBack URL for this entry: http://www.pacificspirit.com/cgi-bin/mt/mt-tb.cgi/253

Leave a comment

About this Entry

This page contains a single entry by Dave Orchard published on April 24, 2009 9:42 PM.

Yet another obscene CEO buyout at Chesapeake ($CHK) and the margin call was the previous entry in this blog.

Creating an archive of an iphone app from unix: ditto is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Categories