Use simpler function to determine dirs

realpath() fails in creative ways under some SAFE MODE circumstances.
The pleasures of working with ad-hoc solutions. Designed to flail.