Swift Playgrounds: Symbolic Links

B Ohr writes:

So I put it to the test.

Single File Test

First test: a single file at the top level of a playground.

  1. Create a playground
  2. Navigate to its Sources (with the playground closed)
  3. Create symbolic link
% cd Sources/
% lns ~/Desktop/test.swift test.swift
Made test.swift -> /Users/ericasadun/Desktop/test.swift

Next, I launched the playground, opened the project navigator, edited test.swift, and attempted to save it.

Screen Shot 2015-05-25 at 2.51.50 PM

Also this:

Screen Shot 2015-05-25 at 2.52.55 PM

 

Every time I then tried to close the playground, I got this:

Screen Shot 2015-05-25 at 2.53.56 PM

I had to force-quit Xcode. The edits never made it to the file. I’d call that a fail.

Folder Test

Next up, symlinks to source folders. Same steps but the source is enclosed in a top-level folder.

% cd ~/Desktop/SymTest2.playground/
% cd Sources
% lns ~/Desktop/External\ Sources/ External\ Sources
Made External Sources -> /Users/ericasadun/Desktop/External Sources

This time, I was able to load, tweak, and save without incident. So, that’s a success.

Dangerous Waters

That said, I did encounter  issues with otherwise “behaving” symlink playgrounds. There was this:

Screen Shot 2015-05-25 at 2.57.49 PM

And sometimes there was this:

Screen Shot 2015-05-25 at 2.57.43 PM

and

Ten Minutes Later

which did ever not resolve, even after I left it for a quarter an hour to spin its wheel. This happened specifically after I closed a symlinked playground, created an additional symlink and then re-launched.

Conclusions

Although you’re likely to have greatest success using symlinks to enclosing folders, the entire symlink system remains pretty fragile. Caveat codeur.

 

 

Comments are closed.