Canonicalize missing directories
realpath does not offer emulation for the equivalent of readlink -m. Running realpath on a non-existent directory returns an empty string.
From http://www.gnu.org/software/coreutils/manual/html_node/readlink-invocation.html#readlink-invocation
‘-m’ ‘--canonicalize-missing’ Activate canonicalize mode. If any component is missing or unavailable, readlink treats it as a directory.
Test suite:
http://www.delorie.com/gnu//dl/ftp.gnu.org/coreutils/coreutils-8.2.tar.gz/coreutils-8.2/tests/readlink/can-m
:+1: here, this is what I came here expecting!
Specifically, it'd be nice if the realpath mode (and specifically canonicalize_path) handled missing paths. At the moment, the behaviour is … rather strange:
$ _canonicalize_file_path blah
/current/working/directory/blah
$ _canonicalize_file_path /blah
//blah
$ _canonicalize_file_path /blah/wtf
<erroneous exit code: 1>