Replacing readlink with cd and pwd

davidbenton reported that `readlink -f` is not available under OSX.