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'.