Fix File.realpath (for #2165)

Fixes #2165