Introduced if/then to get_realpath based upon review.