The path "~person" expands to the home directory of the user named "person".
auto url = URIAddress("file://~foo/bar");
auto myHome = URIAddress("file:///home/dhasenan");
auto pwd = URIAddress("file:///tmp");
writeln(url.expand(myHome, pwd));
That should print file://~foo/bar -- there's not enough information here to expand ~foo. It actually prints file:///home/dhasenan/foo/bar -- pretending that there was a path separator after the tilde.
When you call expand, you are saying that you want an absolute URI address.
However the usage of ~foo expanding is indeed incorrect. It should be checking if there is a / or \ after it.
The path "~person" expands to the home directory of the user named "person".
That should print
file://~foo/bar
-- there's not enough information here to expand~foo
. It actually printsfile:///home/dhasenan/foo/bar
-- pretending that there was a path separator after the tilde.