Jon Voth [Interactive Specialist]

Creating a Symbolic Link

In light of the recent restructuring of how Ham’s code and assets are stored and versioned, we needed a way to store or copy assets from a Dropbox folder into the source code folder of a specific project. Most development projects require assets (like JPGs, PNGs, SWFs, and video files) to be included in the source code folder so individual assets can be referenced locally from code written in the source files. In order to take advantage of Dropbox’s syncing capabilities, all folders and files intended to be synced must be a child of the Dropbox folder itself. This means that project assets synced through Dropbox must be copied into the source folder for the project in order for the source code to reference them.

Options

Originally we had considered several options: copying the files “by hand” as-needed, setting up a folder action to automatically copy the files when new assets are added, setting up an Automator script to copy the files as-needed, or attempting to use an alias.

Copying by hand: This was our fallback. Copying files as-needed would be the most sure-fire way to accomplish the task, but it is also the most tedious and would slow down our overall workflow.

Folder Action: This appeared to work at first, but we soon realized that only newly added files would be copied and would not suit our needs as all updates to files would need to be copied as well.

Automator Script: This worked quite well. Automator allows you to create an application that will run a set of actions, in this case we could set up an application for each project, double click it, and it would copy the files automatically.

Alias: This did not serve our needs as development IDE’s may not recognize the files in the assets folder as accessible via an alias, as they actually reside at a path different from the source folder.

Another consideration we realized while trying to find solutions was that directly copying the files may take a great deal of time and waste storage space for asset-heavy projects.

The Solution

Though making an application with Automator would work, it required the application to be run every time an asset update was needed. Furthermore, all of the solutions mentioned above (save the alias) would still have the issue of storing potentially heavy files twice on your hard drive.

After some research by Cameron (a member of Ham’s dev team) we found the perfect solution: a Symbolic Link. A Symbolic Link creates a “soft link” that resolves the file path of a folder to a different location. In essence, it is like an alias that makes the files within it appear as if they reside at the location of the alias.

How To Make the Link

The Symbolic link is made possible by a free Automator action written by Junecloud software (download it here). Download the actions and take a look at the demo video to see how it’s done (apologies for the Screenflow watermark).