Remove usage of realpath and getRealPath.

As the title says. Removes the usage of `realpath` and `getRealPath` (replaced with `getPathname`).

Reference #1620