I have a bug when my app runs on the iPhone but not when it runs on the simulator. I was using the length of the home directory path to extract the relative path of a file
In Swift 3, URL has the standardizedFileUrl property, which will remove any symlinks and resolve relative parts within the path like ./.
URL
standardizedFileUrl
./
As of writing the documentation is pretty useless but it looks like it is equivialent to NSURL's standardized property.