Add a more consistently behaved version of 'canonicalizePath'.

Behaviour of 'canonicalizePath' is inconsistent among platforms. On *nix, it
throws an exception if the path refers to a non-existent file, but on Windows it
does not.
Replace most uses of 'canonicalizePath' with 'tryCanonicalizePath'.
Merge pull request #1290 from 23Skidoo/try-canonicalize-path

Add a more consistently behaved version of 'canonicalizePath'.