Adding regression test for handling a filename of e.g. '~file.txt'.
Fix handling of paths which may (or may not) require interpolation, without
blowing the stack through infinite recursion.