Extract `realpath` into its own file